Module: RatDeployer::Config
- Defined in:
- lib/rat_deployer/config.rb
Class Method Summary collapse
- .all ⇒ Object
- .env ⇒ Object
- .environmental ⇒ Object
- .for_env(e = env) ⇒ Object
- .images ⇒ Object
-
.machine ⇒ Object
Loads machine config for current env.
- .prompt_enabled? ⇒ Boolean
- .remote ⇒ Object
- .remote_machine_flags ⇒ Object
Class Method Details
.all ⇒ Object
6 7 8 |
# File 'lib/rat_deployer/config.rb', line 6 def self.all @all ||= YAML.load_file(File.('./rat_config.yml')) || {} end |
.env ⇒ Object
10 11 12 |
# File 'lib/rat_deployer/config.rb', line 10 def self.env ENV.fetch('RAT_ENV') end |
.environmental ⇒ Object
18 19 20 |
# File 'lib/rat_deployer/config.rb', line 18 def self.environmental all.fetch('environments', {}) end |
.for_env(e = env) ⇒ Object
22 23 24 25 26 |
# File 'lib/rat_deployer/config.rb', line 22 def self.for_env(e = env) default_conf = environmental.fetch('default', {}) env_conf = environmental.fetch(e) default_conf.deep_merge(env_conf) end |
.images ⇒ Object
14 15 16 |
# File 'lib/rat_deployer/config.rb', line 14 def self.images all.fetch('images', {}) end |
.machine ⇒ Object
Loads machine config for current env. Acceps either a docker-machine machine name or an object with keys ca_cert, cert, key, and host.
35 36 37 |
# File 'lib/rat_deployer/config.rb', line 35 def self.machine for_env.fetch("machine") end |
.prompt_enabled? ⇒ Boolean
28 29 30 |
# File 'lib/rat_deployer/config.rb', line 28 def self.prompt_enabled? ENV['RAT_PROMPT'] != "false" end |
.remote ⇒ Object
39 40 41 42 |
# File 'lib/rat_deployer/config.rb', line 39 def self.remote env_var = ENV['RAT_REMOTE'] env_var.nil? ? true : env_var == 'true' end |
.remote_machine_flags ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rat_deployer/config.rb', line 44 def self.remote_machine_flags case machine when Symbol, String `docker-machine config #{machine}`.gsub(/\n/, ' ') when Hash [ "--tlsverify", "-H='#{machine.fetch('host')}'", "--tlscacert='#{machine.fetch('ca_cert')}'", "--tlscert='#{machine.fetch('cert')}'", "--tlskey='#{machine.fetch('key')}'", ].join(' ') end end |