1
0
Fork 0
forked from OpenNeo/impress
impress/config
Emi Matchu 5b016673d7 Migrate secret key to Rails credentials file (and fix deprecation warn)
There's a bit happening behind the scenes of this change. Previously,
we kept a `SECRET_TOKEN` environment variable in `production.env`, and
used a `secret_token.rb` initializer to wire it up as the
`secret_key_base`.

In this change, we move to Rails's new-ish (two years old :p) encrypted
credentials system. Now, we set a `RAILS_MASTER_KEY` environment
variable in the deployed `production.env` instead (and in our local
`.env.production` in the project root for managing it), and we can run
`rails credentials:edit` to open the encrypted file in a text editor.

Inside, the content is just:
```yml
secret_key_base: "<OUR_SECRET_KEY>"
```

This indirection doesn't exactly do much for us functionally; it's just
the more standard way of achieving what our `secret_token.rb` situation
was achieving.

We could also migrate other secrets into there, and I just might! That
would simplify duplication between `/deploy/files/production.env` and
`/.env.production`, at any rate! The main notable one is
`MATCHU_EMAIL_PASSWORD` for sending auth emails from
`matchu@openneo.net` (and there's also a Stripe token that we don't
actually use in the app these days, those codepaths are old bones). Oh
and there's also the `IMPRESS_2020_SUPPORT_SECRET`!

Anyway, the motivation for this was to remove the warning when starting
the app that Devise is trying to use the deprecated
`Rails.application.secrets` method. I was expecting to have to do
[the workaround shared here](https://github.com/heartcombo/devise/issues/5644#issuecomment-1804626431),
but it turns out whatever default behavior Devise does under the hood
is happy enough with our new decision to use the credentials file, and
the deprecation warning is gone! Ok neat!
2024-02-22 12:36:30 -08:00
..
environments Update SMTP settings 2024-02-18 14:15:23 -08:00
initializers Migrate secret key to Rails credentials file (and fix deprecation warn) 2024-02-22 12:36:30 -08:00
locales Track contributions of Alt Styles 2024-01-24 03:54:43 -08:00
application.rb Replace falcon server with puma 2024-01-23 21:55:26 -08:00
basic_type_hashes.yml vandagyre basic colors (ugh, should be in database) 2014-11-14 19:33:30 -06:00
boot.rb Upgrade to Rails 7.0.6 2023-10-23 19:05:07 -07:00
cable.yml Upgrade to Rails 6.0.6.1 2023-10-23 19:05:06 -07:00
credentials.yml.enc Migrate secret key to Rails credentials file (and fix deprecation warn) 2024-02-22 12:36:30 -08:00
database.yml Save last trade activity time onto User 2024-01-19 00:00:46 -08:00
environment.rb Upgrade to Rails 6.1.7.4 2023-10-23 19:05:07 -07:00
locale_meta.yml es goes public! 2013-02-16 21:39:04 -06:00
routes.rb Move fundraising models into the Fundraising module 2024-02-18 20:29:31 -08:00
storage.yml Run rails app:update 2023-10-23 19:05:05 -07:00