Skip to content

Commit

Permalink
Provide default OTP_SECRET value for development environment (mastodo…
Browse files Browse the repository at this point in the history
  • Loading branch information
akihikodaki authored and Gargron committed Mar 4, 2018
1 parent 7a6eaad commit c110fa6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Federation
LOCAL_DOMAIN=cb6e6126.ngrok.io
LOCAL_HTTPS=true
OTP_SECRET=100c7faeef00caa29242f6b04156742bf76065771fd4117990c4282b8748ff3d99f8fdae97c982ab5bd2e6756a159121377cce4421f4a8ecd2d67bd7749a3fb4
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class User < ApplicationRecord
ACTIVE_DURATION = 14.days

devise :two_factor_authenticatable,
otp_secret_encryption_key: ENV.fetch('OTP_SECRET')
otp_secret_encryption_key: Rails.configuration.x.otp_secret

devise :two_factor_backupable,
otp_number_of_backup_codes: 10
Expand Down
2 changes: 2 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@

Bullet.add_whitelist type: :n_plus_one_query, class_name: 'User', association: :account
end

config.x.otp_secret = ENV.fetch('OTP_SECRET', '1fc2b87989afa6351912abeebe31ffc5c476ead9bf8b3d74cbc4a302c7b69a45b40b1bbef3506ddad73e942e15ed5ca4b402bf9a66423626051104f4b5f05109')
end

ActiveRecordQueryTrace.enabled = ENV.fetch('QUERY_TRACE_ENABLED') { false }
Expand Down
2 changes: 2 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@
'X-Content-Type-Options' => 'nosniff',
'X-XSS-Protection' => '1; mode=block',
}

config.x.otp_secret = ENV.fetch('OTP_SECRET')
end
2 changes: 2 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

config.x.otp_secret = '100c7faeef00caa29242f6b04156742bf76065771fd4117990c4282b8748ff3d99f8fdae97c982ab5bd2e6756a159121377cce4421f4a8ecd2d67bd7749a3fb4'

# Generate random VAPID keys
vapid_key = Webpush.generate_key
config.x.vapid_private_key = vapid_key.private_key
Expand Down

0 comments on commit c110fa6

Please sign in to comment.