Forked from rodrickbrown/gist:09ec42f57185a549d749
Last active
August 29, 2015 14:09
-
-
Save hesco/7b2ca45ad3f8af41a21b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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