Namespace sailorslog & switch bot tokens

This commit is contained in:
Max Wofford 2025-02-23 20:53:27 -05:00
parent 8a978b1269
commit 2c8ee24ec3
5 changed files with 9 additions and 9 deletions

View file

@ -4,9 +4,10 @@ PORT=4000
SLACK_CLIENT_ID=your_client_id_here
SLACK_CLIENT_SECRET=your_client_secret_here
SLACK_SIGNING_SECRET=your_signing_secret_here
SLACK_TEAM_ID=your_slack_workspace_id
SLACK_USER_OAUTH_TOKEN=your_user_oauth_token_here
SLACK_BOT_OAUTH_TOKEN=your_bot_oauth_token_here
# Sailors' log slack app
SLACK_SAILORS_LOG_SIGNING_SECRET=your_signing_secret_here
SLACK_SAILORS_LOG_BOT_OAUTH_TOKEN=your_bot_oauth_token_here
WAKATIME_DATABASE_URL=your_wakatime_database_url_here

View file

@ -56,7 +56,7 @@ class SlackController < ApplicationController
# Skip verification in development
return true if Rails.env.development?
slack_signing_secret = ENV["SLACK_SIGNING_SECRET"]
slack_signing_secret = ENV["SAILORS_LOG_SLACK_SIGNING_SECRET"]
sig_basestring = "v0:#{timestamp}:#{request.raw_post}"
my_signature = "v0=" + OpenSSL::HMAC.hexdigest("SHA256", slack_signing_secret, sig_basestring)

View file

@ -25,7 +25,7 @@ class SailorsLogNotifyJob < ApplicationJob
message = ":boat: <@#{slack_uid}> just coded 1 more hour on *#{project_name}* (total: #{hours}hrs). _#{kudos_message}_"
response = HTTP.auth("Bearer #{ENV['SLACK_BOT_OAUTH_TOKEN']}")
response = HTTP.auth("Bearer #{ENV['SAILORS_LOG_SLACK_BOT_OAUTH_TOKEN']}")
.post("https://slack.com/api/chat.postMessage",
json: {
channel: slack_channel_id,

View file

@ -1,3 +0,0 @@
Slack.configure do |config|
config.token = ENV["SLACK_BOT_OAUTH_TOKEN"] # Using the existing env variable name
end

View file

@ -44,5 +44,7 @@ Rails.application.routes.draw do
get "my/settings", to: "users#edit", as: :my_settings
patch "my/settings", to: "users#update"
post "/slack/commands", to: "slack#create"
namespace :sailors_log do
post "/slack/commands", to: "slack#create"
end
end