Class: Conjur::Command::Env

Inherits:
Conjur::Command show all
Defined in:
lib/conjur/command/env.rb

Class Method Summary collapse

Methods inherited from Conjur::Command

acting_as_option, api, command, command_impl_for_list, command_options_for_list, display, display_members, hide_docs, method_missing, require_arg, retire_resource, retire_role

Methods included from IdentifierManipulation

#conjur_account, #full_resource_id, #get_kind_and_id_from_args

Class Method Details

.common_parameters(c) ⇒ Object

self.prefix = :env



31
32
33
34
35
36
37
38
# File 'lib/conjur/command/env.rb', line 31

def self.common_parameters c
  c.desc "Environment configuration file"
  c.default_value ".conjurenv"
  c.flag ["c"]
  
  c.desc "Environment configuration as inline yaml"
  c.flag ["yaml"]
end

.get_env_object(options) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/conjur/command/env.rb', line 40

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

  env = if options[:yaml] 
          Conjur::Env.new(yaml: options[:yaml])
        else
          Conjur::Env.new(file: (options[:c]||'.conjurenv'))
        end
  return env
end