1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

9 commits

Author SHA1 Message Date
Wojciech Wnętrzak
e0d3313bac Support environment specific credentials file. (#33521)
For `production` environment look first for `config/credentials/production.yml.enc` file that can be decrypted by
`ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key` master key.
Edit given environment credentials file by command `rails credentials:edit --environment production`.
Default behavior can be overwritten by setting `config.credentials.content_path` and `config.credentials.key_path`.
2018-09-19 14:02:00 -07:00
Alberto Almagro
40b209db53 Recommend use of rails over bin/rails
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.

We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
2018-07-06 22:46:35 +02:00
yuuji.yaginuma
df20bf4aa2 Add an assertion that credentials:edit works when RAILS_MASTER_KEY env is specified 2018-06-24 20:57:41 +09:00
Yuji Yaginuma
5d75ef72e6
Do not add master key when RAILS_MASTER_KEY env specified (#31922)
Fixes #31917
2018-02-08 19:49:50 +09:00
yuuji.yaginuma
35373219c9 Raise an error only when require_master_key is specified
To prevent errors from being raise in environments where credentials
is unnecessary.

Context: https://github.com/rails/rails/issues/31283#issuecomment-348801489

Fixes #31283
2017-12-18 08:04:15 +09:00
yuuji.yaginuma
f7e3c68668 Do not overwrite by default if credentials already exists
Fixes #31286
2017-11-30 10:15:45 +09:00
Wojciech Wnętrzak
7a8728a039
Add CLI to manage encrypted files/configs.
To edit/show encrypted file:

```
bin/rails encrypted:edit config/staging_tokens.yml.enc
bin/rails encrypted:edit config/staging_tokens.yml.enc --key config/staging.key
bin/rails encrypted:show config/staging_tokens.yml.enc
```

Also provides a backing Rails.application.encrypted API for Ruby access:

```ruby
Rails.application.encrypted("config/staging_tokens.yml.enc").read
Rails.application.encrypted("config/staging_tokens.yml.enc").config
Rails.application.encrypted("config/staging_tokens.yml.enc", key: "config/staging.key")
```
2017-11-15 21:29:15 +01:00
yuuji.yaginuma
8a331566bf Add tests for credentials command 2017-09-15 14:31:02 +09:00
yuuji.yaginuma
d5d41c8281 Make master key added to gitignore the same value as when creating appplication
For gitignore generated by `rails new`, key with a leading slash is specified.
69f976b859/railties/lib/rails/generators/rails/app/templates/gitignore (L11)

Therefore, when executing `credentials:edit`, also need leading slack.
In order to avoid such a difference, fixed to use same method for
`rails new` and `credentials:edit`.
2017-09-14 07:17:25 +09:00