0

I could not fine the

secret.yml

format in ruby on rails application I have created. Can anyone help and tell me how to generate a new one.

Thank before hand.

Chanrithisak Phok
  • 1,590
  • 1
  • 19
  • 29

2 Answers2

1

If you don't have it generate it !!!

bundle exec rake secret

Update.

paste generated string to your config/secret.yml

development:
  secret_key_base: <key>
NeverBe
  • 5,213
  • 2
  • 25
  • 39
1

rails version 5.1

if your rails version 5.1, this command below will generate 2 files. config/secrets.yml.key contains the key that will encrypt and decrypt your secrets

bin/rails secrets:setup

After creating the key, even though config/secrets.yml.enc is not empty, it doesn't contain any secrets. To add your secrets, run

bin/rails secrets:edit

rails version 5.2

meanwhile if your Rails version 5.2, or above replaces both secrets with encrypted credentials. You cannot use plain text credentials. There's only credentials.yml.enc. The encrypted credentials are saved on config/credentials.yml.enc. Don't edit the file directly. To add credentials, run

bin/rails credentials:edit
widjajayd
  • 6,090
  • 4
  • 30
  • 41