Module: ConfigTemplate

Defined in:
lib/docker-sync/config_template.rb

Class Method Summary collapse

Class Method Details

.interpolate_config_file(config_path) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/docker-sync/config_template.rb', line 5

def self.interpolate_config_file(config_path)
    env_hash = {}
    ENV.each {|k,v| env_hash[k.to_sym] = v }
    # assuming the checks that file exist have already been performed
    config_string = File.read(config_path)
    config_string.gsub!('${', '%{')
    config_string = config_string % env_hash
    return YAML.load(config_string)
end