Module: Conjur

Extended by:
Conjur
Included in:
Conjur
Defined in:
lib/conjur/env.rb,
lib/conjur/log.rb,
lib/conjur/base.rb,
lib/conjur/cast.rb,
lib/conjur/host.rb,
lib/conjur/role.rb,
lib/conjur/user.rb,
lib/conjur/group.rb,
lib/conjur/layer.rb,
lib/conjur/deputy.rb,
lib/conjur/escape.rb,
lib/conjur/exists.rb,
lib/conjur/has_id.rb,
lib/conjur/secret.rb,
lib/conjur/core-api.rb,
lib/conjur/resource.rb,
lib/conjur/variable.rb,
lib/conjur/api/audit.rb,
lib/conjur/api/authn.rb,
lib/conjur/api/hosts.rb,
lib/conjur/api/roles.rb,
lib/conjur/api/users.rb,
lib/conjur/audit-api.rb,
lib/conjur/authn-api.rb,
lib/conjur/authz-api.rb,
lib/conjur/has_owner.rb,
lib/conjur/api/groups.rb,
lib/conjur/api/layers.rb,
lib/conjur/log_source.rb,
lib/conjur/path_based.rb,
lib/conjur/role_grant.rb,
lib/conjur-api/version.rb,
lib/conjur/annotations.rb,
lib/conjur/api/pubkeys.rb,
lib/conjur/api/secrets.rb,
lib/conjur/acts_as_role.rb,
lib/conjur/acts_as_user.rb,
lib/conjur/api/deputies.rb,
lib/conjur/event_source.rb,
lib/conjur/acts_as_asset.rb,
lib/conjur/api/resources.rb,
lib/conjur/api/variables.rb,
lib/conjur/configuration.rb,
lib/conjur/has_attributes.rb,
lib/conjur/has_identifier.rb,
lib/conjur/acts_as_resource.rb,
lib/conjur/standard_methods.rb,
lib/conjur/build_from_response.rb

Overview

Copyright © 2013 Conjur Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: ActsAsAsset, ActsAsResource, ActsAsRole, ActsAsUser, Audit, Authn, Authz, BuildFromResponse, Cast, Core, Escape, Exists, HasAttributes, HasId, HasIdentifier, HasOwner, LogSource, PathBased, StandardMethods Classes: API, Annotations, Configuration, Deputy, EventSource, Group, Host, InvalidToken, Layer, Resource, Role, RoleGrant, Secret, User, Variable

Constant Summary collapse

@@env_log =
create_log ENV['CONJURAPI_LOG']
@@log =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationObject

Gets the current thread-local or global configuration.



34
35
36
# File 'lib/conjur/configuration.rb', line 34

def configuration
  Thread.current[:conjur_configuration] || (@config ||= Configuration.new)
end

.configuration=(config) ⇒ Object

Sets the global configuration.



39
40
41
# File 'lib/conjur/configuration.rb', line 39

def configuration=(config)
  @config = config
end

.create_log(param) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/conjur/log.rb', line 29

def self.create_log param
  if param
    if param.is_a? String
      if param == 'stdout'
        Logger.new $stdout
      elsif param == 'stderr'
        Logger.new $stderr
      else
        Logger.new param
      end
    else
      param
    end
  end
end

.logObject

:nodoc:



49
50
51
# File 'lib/conjur/log.rb', line 49

def self.log # :nodoc:
  @@env_log || @@log
end

.log=(log) ⇒ Object

You can also configure logging by the environment variable CONJURAPI_LOG.



25
26
27
# File 'lib/conjur/log.rb', line 25

def self.log= log
  @@log = create_log log
end

.with_configuration(config, &block) ⇒ Object

Sets the Configuration for the current thread, yields the block, then resets the thread-local variable.



25
26
27
28
29
30
31
# File 'lib/conjur/configuration.rb', line 25

def with_configuration(config, &block)
  oldvalue = Thread.current[:conjur_configuration]
  Thread.current[:conjur_configuration] = config
  yield
ensure
  Thread.current[:conjur_configuration] = oldvalue
end

Instance Method Details

#accountObject



28
29
30
# File 'lib/conjur/env.rb', line 28

def 
  Conjur.configuration.
end

#envObject



32
33
34
# File 'lib/conjur/env.rb', line 32

def env
  Conjur.configuration.env
end

#service_base_portObject



24
25
26
# File 'lib/conjur/env.rb', line 24

def service_base_port
  Conjur.configuration.service_base_port
end

#stackObject



36
37
38
# File 'lib/conjur/env.rb', line 36

def stack
  Conjur.configuration.stack
end