Class: CollavreSlack::Configuration
- Inherits:
-
Object
- Object
- CollavreSlack::Configuration
- Defined in:
- lib/collavre_slack/configuration.rb
Overview
Slack engine configuration.
OAuth credential getters (‘client_id`, `client_secret`, `signing_secret`, `redirect_uri`) resolve through `Collavre::IntegrationSettings::Resolver`, which honors the DB > ENV > registered default precedence. Writers are preserved so tests and explicit `CollavreSlack.configure` overrides keep working: an explicitly-assigned value short-circuits the resolver.
Fallback to plain ‘ENV` when the resolver is not usable:
- `integration_settings` table missing (db:create, db:schema:load,
assets:precompile, fresh installs)
- DB connection not established
- `Collavre::IntegrationSettings` API not present in the installed
core `collavre` gem (e.g. `USE_COLLAVRE_GEM=true` pinned to a
version predating this feature)
Constant Summary collapse
- RESOLVER_KEYS =
{ client_id: { registry: :slack_client_id, env: "SLACK_CLIENT_ID" }, client_secret: { registry: :slack_client_secret, env: "SLACK_CLIENT_SECRET" }, signing_secret: { registry: :slack_signing_secret, env: "SLACK_SIGNING_SECRET" }, redirect_uri: { registry: :slack_redirect_uri, env: "SLACK_REDIRECT_URI" } }.freeze
Instance Attribute Summary collapse
-
#client_id ⇒ Object
writeonly
Sets the attribute client_id.
-
#client_secret ⇒ Object
writeonly
Sets the attribute client_secret.
-
#redirect_uri ⇒ Object
writeonly
Sets the attribute redirect_uri.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#signing_secret ⇒ Object
writeonly
Sets the attribute signing_secret.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 |
# File 'lib/collavre_slack/configuration.rb', line 28 def initialize @scopes = ENV.fetch("SLACK_SCOPES", "chat:write,channels:read,channels:history,groups:read,im:read,mpim:read,users:read,users:read.email,reactions:read,reactions:write") end |
Instance Attribute Details
#client_id=(value) ⇒ Object (writeonly)
Sets the attribute client_id
25 26 27 |
# File 'lib/collavre_slack/configuration.rb', line 25 def client_id=(value) @client_id = value end |
#client_secret=(value) ⇒ Object (writeonly)
Sets the attribute client_secret
25 26 27 |
# File 'lib/collavre_slack/configuration.rb', line 25 def client_secret=(value) @client_secret = value end |
#redirect_uri=(value) ⇒ Object (writeonly)
Sets the attribute redirect_uri
25 26 27 |
# File 'lib/collavre_slack/configuration.rb', line 25 def redirect_uri=(value) @redirect_uri = value end |
#scopes ⇒ Object
Returns the value of attribute scopes.
26 27 28 |
# File 'lib/collavre_slack/configuration.rb', line 26 def scopes @scopes end |
#signing_secret=(value) ⇒ Object (writeonly)
Sets the attribute signing_secret
25 26 27 |
# File 'lib/collavre_slack/configuration.rb', line 25 def signing_secret=(value) @signing_secret = value end |