Skip to content

Instantly share code, notes, and snippets.

@hesco
Forked from rodrickbrown/gist:09ec42f57185a549d749
Last active August 29, 2015 14:09
Show Gist options
  • Save hesco/7b2ca45ad3f8af41a21b to your computer and use it in GitHub Desktop.
Save hesco/7b2ca45ad3f8af41a21b to your computer and use it in GitHub Desktop.
require 'facter'
Facter.add(:system_env) do
setcode do
hostname = Facter::Util::Resolution.exec('hostname -s')
if hostname[4] == "p"
env = "prod"
elsif hostname[4] == "d"
env = "dev"
elsif hostname[4] == "u"
env = "uat"
elsif hostname[4] == "q"
env = "qa"
else
env = "unknown"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment