cfenv, inspired by cf shell helper

53 views
Skip to first unread message

Ben Hale

unread,
Jun 2, 2014, 11:57:24 AM6/2/14
to vcap...@cloudfoundry.org
After reading Dan's post about cf shell helper last Friday, I was inspired.  Actually, I became a bit obsessed by the idea of switching Cloud Foundry environments.  On a daily basis I work across 3 instances of Cloud Foundry, in at least 5 different spaces so running cf api, cf login, and cf target, is a way of life and not one I'm particularly fond of.  Immediately upon seeing his work, I recognized how similar it was to another tool I use on a daily basis, rbenv.  So this weekend I forked rbenv, created cfenv, and am happy to announce it today.

cfenv is a way of managing multiple Cloud Foundry environments simultaneously, using a series of CF_HOME directories. It allows you to choose the Cloud Foundry environment at a global level (using a ~/.cfenv/environment file), at a project level (using a .cf-environment file), or in a particular shell (using a CFENV_ENVIRONMENT environment variable).  An example of how I might use cfenv:
  1. Most of the day I spend pushing to my own development environment.  Therefore I've run cfenv global development to ensure that by default I use api.run.pivotal.io/bhale/development.
  2. Whenever I work on the java-buildpack-system-tests I want to push to our system test environment.  Therefore, I've gone into that project's directory and run cfenv local system-test to ensure that I always push into api.run.pivotal.io/jbp-test/system-test.
  3. Occasionally I need to push to a copy of Cloud Foundry installed using bosh-lite to test offline buildpack behavior.  When that happens I run cfenv shell bosh-lite to ensure that I push to api.10.244.0.34.xip.io/admin/admin without affecting any other shells.
Suffice it to say, if you're familiar with how rbenv works, you'll feel right at home with cfenv.  Please see the installation instructions for how to install it (and its close relative cf-build), but for OS X Homebrew users, TL;DR:

$ brew tap nebhale/personal
$ brew install cfenv cf
-build
$ echo
'eval "$(cfenv init -)"' >> ~/.bash_profile
$ source ~/
.bash_profile

$ cfenv create development
$ cfenv
global development
$ cf login

Please note that this project is not, in any way, associated with Pivotal or my day job working on the Cloud Foundry Java Experience; this is just something I've put together, and will be supporting, in my spare time.

Once again, a huge thanks goes out to Dan Mikusa for highlighting the issue and a possible path to solving it.  Hope you guys find cfenv as useful as I do.


-Ben Hale

Mike Youngstrom

unread,
Jun 2, 2014, 5:37:00 PM6/2/14
to vcap...@cloudfoundry.org
Nice!  I may make use of this.  Thanks Ben.

Mike


--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/da357b6a-ae54-4ffc-a03a-4139fbd1643a%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Christopher Ferris

unread,
Jun 4, 2014, 9:03:23 PM6/4/14
to vcap...@cloudfoundry.org
Sweet!

- Chris


Reply all
Reply to author
Forward
0 new messages