Class: Dev::Slack::Global
- Defined in:
- lib/firespring_dev_commands/slack/global.rb
Overview
A class to manage slack global configuration settings
Constant Summary collapse
- CONFIG_FILE =
The filename where we store the local auth information
"#{Dir.home}/.env.slack".freeze
- SLACK_API_TOKEN =
The name of the environmental setting which holds the slack token
'SLACK_API_TOKEN'.freeze
Instance Method Summary collapse
-
#configure ⇒ Object
Method to load the slack config file and then configure slack.
-
#write!(api_token) ⇒ Object
Write the new slack auth value to the env file.
Instance Method Details
#configure ⇒ Object
Method to load the slack config file and then configure slack
15 16 17 18 19 20 21 22 23 |
# File 'lib/firespring_dev_commands/slack/global.rb', line 15 def configure # Always load the env slack auth Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE) ::Slack.configure do |c| c.token = ENV.fetch(SLACK_API_TOKEN, nil) c.logger = LOG if ENV['ENABLE_SLACK_DEBUG'].to_s.strip == 'true' end end |
#write!(api_token) ⇒ Object
Write the new slack auth value to the env file
29 30 31 32 33 34 |
# File 'lib/firespring_dev_commands/slack/global.rb', line 29 def write!(api_token) override = Dev::Env.new(CONFIG_FILE) override.set(SLACK_API_TOKEN, api_token) override.write configure end |