Class: CollavreSlack::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

Parameters:

  • value

    the value to set the attribute client_id to.



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

Parameters:

  • value

    the value to set the attribute client_secret to.



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

Parameters:

  • value

    the value to set the attribute redirect_uri to.



25
26
27
# File 'lib/collavre_slack/configuration.rb', line 25

def redirect_uri=(value)
  @redirect_uri = value
end

#scopesObject

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

Parameters:

  • value

    the value to set the attribute signing_secret to.



25
26
27
# File 'lib/collavre_slack/configuration.rb', line 25

def signing_secret=(value)
  @signing_secret = value
end