aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands/credentials_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Do not use the same temp file in different testsyuuji.yaginuma2019-07-271-4/+5
| | | | | It causes unexpected results when running tests in parallel. Ref: https://buildkite.com/rails/rails/builds/62610#0165f6d9-b9c8-4948-9319-07b58bfbfd4f/989-998
* Prettify diff generated by git for encripted file:Edouard CHIN2019-07-261-1/+100
| | | | | | | | | | | | | | | | | | | | | | | | - @sinsoku had the idea and started implementing it few months ago but sadly didn't finish it. This PR is taking over his work. The credentials feature has changed a lot since @sinsoku opened hi PR, it was easier to just restart from scratch instead of checking out his branch. Sinsoku will get all the credit he deserves for this idea :) TL;DR on that that feature is to make the `git diff` or `git log` of encrypted files to be readable. The previous implementation was only setting up the git required configuration for the first time Rails was bootstraped, so I decided to instead provide the user a choice to opt-in for readable diff credential whenever a user types the `bin/rails credentials:edit` command. The question won't be asked in the future the user has already answered or if the user already opted in. Co-authored-by: Takumi Shotoku <insoku.listy@gmail.com>
* Reword test names in credentials_test.rbSharang Dashputre2019-03-251-4/+4
|
* Add `secret_key_base` when creating new credential fileyuuji.yaginuma2019-03-231-1/+12
| | | | | | | | Since `secret_key_base` is expected to be included in credential file, `secret_key_base` should be included even if re-create the file. This is the same behavior as creating a new app. When env is specified, it may be unnecessary, so I added it only when not specifying env.
* Properly expand the environment's name in all commandsyuuji.yaginuma2019-03-151-0/+14
| | | | | | | | | | | | | Since 3777701f1380f3814bd5313b225586dec64d4104, the environment's name is automatically expanded in console and dbconsole commands. In order to match the behavior between the commands, fixes it to have the same behavior of all the commands. This behavior is defined in `EnvironmentArgument`. Since `EnvironmentArgument` also defines the environment option, it is reused. However, since desc was not content that can be used in all comments, fixed desc to be defined for each command.
* Railities typo fixes.alkesh262019-02-011-1/+1
|
* Don't load app environment when editing credentialsChristos Zisopoulos2018-12-261-0/+8
| | | | This avoids missing key exceptions caused by code that tries to read the credentials before they have been added to the encrypted file, for example when editing the credentials for a new environment.
* Support environment specific credentials file. (#33521)Wojciech Wnętrzak2018-09-191-5/+21
| | | | | | 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`.
* Recommend use of rails over bin/railsAlberto Almagro2018-07-061-1/+1
| | | | | | | | | 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.
* Add an assertion that `credentials:edit` works when `RAILS_MASTER_KEY` env ↵yuuji.yaginuma2018-06-241-1/+1
| | | | is specified
* Do not add master key when `RAILS_MASTER_KEY` env specified (#31922)Yuji Yaginuma2018-02-081-0/+12
| | | Fixes #31917
* Raise an error only when `require_master_key` is specifiedyuuji.yaginuma2017-12-181-6/+20
| | | | | | | | | To prevent errors from being raise in environments where credentials is unnecessary. Context: https://github.com/rails/rails/issues/31283#issuecomment-348801489 Fixes #31283
* Do not overwrite by default if credentials already existsyuuji.yaginuma2017-11-301-0/+8
| | | | Fixes #31286
* Add CLI to manage encrypted files/configs.Wojciech Wnętrzak2017-11-151-1/+4
| | | | | | | | | | | | | | | | | | 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") ```
* Add tests for credentials commandyuuji.yaginuma2017-09-151-0/+19
|
* Make master key added to gitignore the same value as when creating appplicationyuuji.yaginuma2017-09-141-0/+30
For gitignore generated by `rails new`, key with a leading slash is specified. https://github.com/rails/rails/blob/69f976b859cae7f9d050152103da018b7f5dda6d/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`.