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, annotate_option, api, api=, assert_empty, collection_option, command, command_impl_for_list, command_options_for_list, context_option, current_role, current_user, destination_role, display, display_members, elevated?, give_away_resource, has_admin?, hide_docs, highline, integer?, interactive_option, method_missing, min_version, notify_deprecated, prompt_for_annotations, prompt_for_group, prompt_for_id, prompt_for_idnumber, prompt_for_password, prompt_for_public_key, prompt_to_confirm, read_till_eof, require_arg, retire_internal_role, retire_options, retire_resource, retire_role, validate_privileges, validate_public_key, validate_retire_privileges

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



28
29
30
31
32
33
34
35
36
37
38
39
# 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) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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