Class: SecretConfig
- Inherits:
-
Object
- Object
- SecretConfig
- Defined in:
- lib/apollo_commons_ruby/SecretConfig.rb
Instance Attribute Summary collapse
-
#authToken ⇒ Object
readonly
Returns the value of attribute authToken.
-
#domainId ⇒ Object
readonly
Returns the value of attribute domainId.
-
#heraAuthToken ⇒ Object
readonly
Returns the value of attribute heraAuthToken.
-
#templateDirectory ⇒ Object
readonly
Returns the value of attribute templateDirectory.
-
#userId ⇒ Object
readonly
Returns the value of attribute userId.
Instance Method Summary collapse
-
#initialize(environment) ⇒ SecretConfig
constructor
A new instance of SecretConfig.
Constructor Details
#initialize(environment) ⇒ SecretConfig
Returns a new instance of SecretConfig.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/apollo_commons_ruby/SecretConfig.rb', line 9 def initialize(environment) if file_exists?("./.apollo/#{environment}.json") conf_file = File.read(File.("./.apollo/#{environment}.json")) conf = JSON.parse conf_file if (conf["tenantAuthToken"] == nil) puts "Auth configurations are missing" return nil end @authToken = conf["tenantAuthToken"] elsif (File.exist? ("/var/jenkins_home/template_config/config.json")) conf_file = File.read(File.("/var/jenkins_home/template_config/config.json")); conf = JSON.parse conf_file conf = conf[environment.downcase] if (conf["authToken"] == nil || conf["heraAuthToken"] == nil) puts "Security configurations are missing" return nil end @authToken = conf["authToken"] @userId = conf["userId"] @domainId = conf["domainId"] @heraAuthToken = conf["heraAuthToken"] @templateDirectory = conf["templateDirectory"] end end |
Instance Attribute Details
#authToken ⇒ Object (readonly)
Returns the value of attribute authToken.
3 4 5 |
# File 'lib/apollo_commons_ruby/SecretConfig.rb', line 3 def authToken @authToken end |
#domainId ⇒ Object (readonly)
Returns the value of attribute domainId.
5 6 7 |
# File 'lib/apollo_commons_ruby/SecretConfig.rb', line 5 def domainId @domainId end |
#heraAuthToken ⇒ Object (readonly)
Returns the value of attribute heraAuthToken.
6 7 8 |
# File 'lib/apollo_commons_ruby/SecretConfig.rb', line 6 def heraAuthToken @heraAuthToken end |
#templateDirectory ⇒ Object (readonly)
Returns the value of attribute templateDirectory.
7 8 9 |
# File 'lib/apollo_commons_ruby/SecretConfig.rb', line 7 def templateDirectory @templateDirectory end |
#userId ⇒ Object (readonly)
Returns the value of attribute userId.
4 5 6 |
# File 'lib/apollo_commons_ruby/SecretConfig.rb', line 4 def userId @userId end |