How to find the Chef environment in a recipe?
Solution 1:
Look in the chef_environment Ruby attribute (not a regular Chef attribute) on the node:
if node.chef_environment == "dev"
# stuff
end
Solution 2:
another elegant way:
if ['production','development'].include? node.chef_environment
#do something here
end