Class: Underway::Settings::Configuration
- Inherits:
-
Object
- Object
- Underway::Settings::Configuration
- Defined in:
- lib/underway/settings.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#app_issuer ⇒ Object
The Integration ID From “About -> ID” at github.com/settings/apps/<app-name>.
- #app_root=(directory) ⇒ Object
- #config_filename=(filename) ⇒ Object
- #db ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load! ⇒ Object
-
#private_key ⇒ Object
Private Key for the App, generated based on the PEM file.
- #private_key_filename ⇒ Object
-
#private_pem ⇒ Object
PEM file for request signing (PKCS#1 RSAPrivateKey format) (Download from github.com/settings/apps/<app-name> “Private key”).
-
#raw ⇒ Object
TODO: deprecate.
- #token_cache ⇒ Object
- #verbose_logging ⇒ Object
-
#webhook_secret ⇒ Object
Integration webhook secret (for validating that webhooks come from GitHub).
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 |
# File 'lib/underway/settings.rb', line 9 def initialize @logger = Underway::Logger.new end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/underway/settings.rb', line 7 def config @config end |
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/underway/settings.rb', line 7 def logger @logger end |
Instance Method Details
#app_issuer ⇒ Object
The Integration ID From “About -> ID” at github.com/settings/apps/<app-name>
46 47 48 |
# File 'lib/underway/settings.rb', line 46 def app_issuer @app_issuer ||= config["app_id"] end |
#app_root=(directory) ⇒ Object
24 25 26 |
# File 'lib/underway/settings.rb', line 24 def app_root=(directory) @app_root = Pathname.new(directory).dirname end |
#config_filename=(filename) ⇒ Object
28 29 30 |
# File 'lib/underway/settings.rb', line 28 def config_filename=(filename) @config_filename = filename end |
#db ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/underway/settings.rb', line 36 def db @db ||= begin Underway::DB.configure(config["database_url"]) Underway::DB.instance.database end end |
#load! ⇒ Object
13 14 15 16 17 |
# File 'lib/underway/settings.rb', line 13 def load! @config = JSON.parse( @app_root.join(@config_filename).read ) end |
#private_key ⇒ Object
Private Key for the App, generated based on the PEM file
66 67 68 |
# File 'lib/underway/settings.rb', line 66 def private_key @private_key ||= OpenSSL::PKey::RSA.new(private_pem) end |
#private_key_filename ⇒ Object
55 56 57 |
# File 'lib/underway/settings.rb', line 55 def private_key_filename @app_root.join(config["private_key_filename"]) end |
#private_pem ⇒ Object
PEM file for request signing (PKCS#1 RSAPrivateKey format) (Download from github.com/settings/apps/<app-name> “Private key”)
61 62 63 |
# File 'lib/underway/settings.rb', line 61 def private_pem @private_pem ||= File.read(private_key_filename) end |
#raw ⇒ Object
TODO: deprecate
20 21 22 |
# File 'lib/underway/settings.rb', line 20 def raw @config end |
#token_cache ⇒ Object
74 75 76 |
# File 'lib/underway/settings.rb', line 74 def token_cache @token_cache ||= Underway::TokenCache.new(db) end |
#verbose_logging ⇒ Object
70 71 72 |
# File 'lib/underway/settings.rb', line 70 def verbose_logging @verbose ||= config["verbose_logging"] end |
#webhook_secret ⇒ Object
Integration webhook secret (for validating that webhooks come from GitHub)
51 52 53 |
# File 'lib/underway/settings.rb', line 51 def webhook_secret @webhook_secret ||= config["webhook_secret"] end |