1
0
Fork 0
forked from OpenNeo/impress

Use a hardcoded SECRET_TOKEN, in development only

Oh right, we intentionally fail if there's no SECRET_TOKEN provided, but
that's not really useful for development!

Here, we add a SECRET_TOKEN only used in development - which doesn't
need to be secret, because it doesn't guard actual user sessions!

In production, the behavior is unchanged.
This commit is contained in:
Emi Matchu 2023-10-25 15:54:19 -07:00
parent 024041e591
commit b756ae023e

View file

@ -9,4 +9,11 @@
# Make sure your secret_key_base is kept private # Make sure your secret_key_base is kept private
# if you're sharing your code publicly. # if you're sharing your code publicly.
if Rails.env.development?
# In development, we use a hardcoded secret key, because it doesn't actually
# need to be secret!
OpenneoImpressItems::Application.config.secret_key_base = "7584841652f89044a8b5a428efa6dfac2461449eb24741a33668cd642130d79f93b0347766ebf4a4d7d5033a263c36431594ad56b5735a7325c8cdda991219c2"
else
# In general, we use the SECRET_TOKEN provided as an environment variable!
OpenneoImpressItems::Application.config.secret_key_base = ENV.fetch('SECRET_TOKEN') OpenneoImpressItems::Application.config.secret_key_base = ENV.fetch('SECRET_TOKEN')
end