lib/commands/add-env.rb in canzea-0.1.57 vs lib/commands/add-env.rb in canzea-0.1.58

- old
+ new

@@ -1,9 +1,13 @@ require 'json' +require 'logger' require 'plan-step-class' class AddEnv + def initialize () + @log = Logger.new(Canzea::config[:logging_root] + '/plans.log') + end def add (key, value) extraConfig = Canzea::config[:catalog_location] + "/env.json" envs = loadFile() envs["vars"][key] = value @@ -28,21 +32,24 @@ return envs end def injectEnvironmentVariables() extraConfig = Canzea::config[:catalog_location] + "/env.json" + @log.info "Looking to read env.json" if File.exists?(extraConfig) puts "-- Reading #{extraConfig}" file = File.read(extraConfig) envs = JSON.parse(file) envs['vars'].keys.each { | key | val = envs['vars'][key] puts "-- #{key} == #{val}" + @log.info "Setting: #{key} == #{val}" ENV.store(key, val) } envs['secrets'].keys.each { | key | val = envs['secrets'][key] puts "-- #{key} == XXXXXX" + @log.info "Setting: #{key} == XXXXXXX" ENV.store(key, val) } end end end \ No newline at end of file