Simplest thing would likely be to add the following to your knife.rb:
Thhis would set your cookbook path to the value of the CHEF_REPO variable in your environment.
You could also set a default in case you don’t have it set:
cb_path = ENV[‘CHEF_REPO’] || ~/cookbooks
From: Cassiano Leal [mailto:firstname.lastname@example.org]
Sent: 26 July 2012 13:17
Subject: [chef] Chef repo environment variable?
I have been wondering, but couldn’t find anything on the interwebs… Is there a way to point knife to the correct chef-repo path via an environment variable, say CHEF_HOME, or CHEF_REPO?
The reason I ask is that I have several contexts in my workstation (work, private project 1, private project 2, …). I use shell aliases to set several environment variables for each context (AWS keys and paths, other stuff), and when I open a new shell I just call the alias to set the context.
Jon-Paul Sullivan Cloud Services - @hpcloud
Postal Address: Hewlett-Packard Galway Limited, Ballybrit Business Park, Galway.
Registered Office: Hewlett-Packard Galway Limited, 63-74 Sir John Rogerson’s Quay, Dublin 2.
Registered Number: 361933
The contents of this message and any attachments to it are confidential and may be legally privileged. If you have received this message in error you should delete it from your system immediately and advise the sender.
To any recipient of this message within HP, unless otherwise stated, you should consider this message and attachments as “HP CONFIDENTIAL”.