Class: Jerakia
- Inherits:
-
Object
- Object
- Jerakia
- Defined in:
- lib/jerakia.rb,
lib/jerakia/cli.rb,
lib/jerakia/util.rb,
lib/jerakia/error.rb,
lib/jerakia/answer.rb,
lib/jerakia/policy.rb,
lib/jerakia/server.rb,
lib/jerakia/request.rb,
lib/jerakia/version.rb,
lib/jerakia/launcher.rb,
lib/jerakia/cli/token.rb,
lib/jerakia/util/http.rb,
lib/jerakia/cli/config.rb,
lib/jerakia/cli/lookup.rb,
lib/jerakia/cli/secret.rb,
lib/jerakia/cli/server.rb,
lib/jerakia/datasource.rb,
lib/jerakia/dsl/lookup.rb,
lib/jerakia/dsl/policy.rb,
lib/jerakia/encryption.rb,
lib/jerakia/server/auth.rb,
lib/jerakia/server/rest.rb,
lib/jerakia/encryption/vault.rb,
lib/jerakia/server/auth/token.rb,
lib/jerakia/lookup/plugin_config.rb
Overview
Jerakia::Lookup::PluginConfig
This class is a simple wrapper class to expose configuration options from the global configuration file to lookup plugins. It’s exposed to the lookup as the config method. Eg: config
Defined Under Namespace
Modules: Dsl, Util Classes: Answer, CLI, Cache, Config, Datasource, DatasourceArgumentError, Encryption, EncryptionError, Error, FileParseError, HTTPError, Launcher, Log, Lookup, Policy, PolicyError, Request, Response, Schema, SchemaError, Scope, Server
Constant Summary collapse
- VERSION =
Public API to retrieve the latest released version of the code
This should be updated when a new gem is released and it is read from the gemspec file
'2.3.0'.freeze
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
-
.log ⇒ Object
Returns the value of attribute log.
Instance Attribute Summary collapse
-
#launcher ⇒ Object
readonly
Returns the value of attribute launcher.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(options = {}) ⇒ Jerakia
constructor
A new instance of Jerakia.
- #log ⇒ Object
- #lookup(request) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Jerakia
Returns a new instance of Jerakia.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jerakia.rb', line 28 def initialize( = {}) @options = @policies = {} load_config load_log_handler if config[:plugindir] $LOAD_PATH << config[:plugindir] unless $LOAD_PATH.include?(config[:plugindir]) end log.debug('Jerakia initialized') Jerakia.log.verbose("Jerakia started. Version #{Jerakia::VERSION}") @launcher = Jerakia::Launcher.new end |
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
21 22 23 |
# File 'lib/jerakia.rb', line 21 def config @config end |
.log ⇒ Object
Returns the value of attribute log.
22 23 24 |
# File 'lib/jerakia.rb', line 22 def log @log end |
Instance Attribute Details
#launcher ⇒ Object (readonly)
Returns the value of attribute launcher.
18 19 20 |
# File 'lib/jerakia.rb', line 18 def launcher @launcher end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'lib/jerakia.rb', line 17 def @options end |
Class Method Details
Instance Method Details
#config ⇒ Object
57 58 59 |
# File 'lib/jerakia.rb', line 57 def config self.class.config end |
#log ⇒ Object
61 62 63 |
# File 'lib/jerakia.rb', line 61 def log self.class.log end |
#lookup(request) ⇒ Object
44 45 46 47 |
# File 'lib/jerakia.rb', line 44 def lookup(request) raise Jerakia::PolicyError, "Policy '#{request.policy}' not defined" unless launcher.policy_exists?(request.policy) launcher.policies[request.policy.to_sym].run(request) end |