class Conjur::Command::Env

Public Class Methods

common_parameters(c) click to toggle source

self.prefix = :env

# File lib/conjur/command/env.rb, line 28
def self.common_parameters c
  c.desc "Environment configuration file"
  c.arg_name "FILE"
  c.default_value ".conjurenv"
  c.flag ["c"]
  
  c.desc "Environment configuration as inline yaml"
  c.flag ["yaml"]

  c.desc "Policy id to substitute for $policy in the YAML values"
  c.flag ["policy"]
end
get_env_object(options) click to toggle source
# File lib/conjur/command/env.rb, line 41
def self.get_env_object options
  require 'conjur/conjurenv'

  if options[:yaml] and options[:c]!='.conjurenv'
    exit_now! "Options -c and --yaml can not be provided together"
  end

  env_options = if options[:yaml] 
    { yaml: options[:yaml]}
  else
    { file: (options[:c]||'.conjurenv') }
  end
  env_options[:substitutions] = { "$policy" => options[:policy] } if options[:policy]
  Conjur::Env.new env_options
end