Merge pull request #9719 from mkllnk/secrets-config

Simplify config of secret token
This commit is contained in:
Rachel Arnould
2022-10-04 20:36:03 +02:00
committed by GitHub
4 changed files with 11 additions and 10 deletions

View File

@@ -1,7 +1,11 @@
# ENV vars for the development environment
# Override locally with `.env.development.local`
#
# You may also want to use this when testing other environments locally:
#
# cp .env.development .env.local
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
OFN_REDIS_URL="redis://localhost:6379/1"
OFN_REDIS_JOBS_URL="redis://localhost:6379/2"

View File

@@ -1,7 +1,7 @@
# ENV vars for the test environment
# Override locally with `.env.test.local`
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
SECRET_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
STRIPE_SECRET_TEST_API_KEY="bogus_key"
STRIPE_CUSTOMER="bogus_customer"

3
.gitignore vendored
View File

@@ -57,3 +57,6 @@ coverage
/yarn-error.log
yarn-debug.log*
.yarn-integrity
/config/credentials.yml.enc
/config/master.key

View File

@@ -5,14 +5,8 @@
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
secret_key = if Rails.env.development? or Rails.env.test?
('x' * 30) # Meets basic minimum of 30 chars.
else
ENV["SECRET_TOKEN"]
end
# Rails 4+ key for signing and encrypting cookies.
Openfoodnetwork::Application.config.secret_key_base = secret_key
Openfoodnetwork::Application.config.secret_key_base = ENV["SECRET_TOKEN"]
# Legacy secret_token variable. This is still used directly for encryption.
Openfoodnetwork::Application.config.secret_token = secret_key
Openfoodnetwork::Application.config.secret_token = ENV["SECRET_TOKEN"]