Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing `secret_token` and `secret_key_base` for 'development' environment, set these values in `config/secrets.yml`

When I try to run rails server command I get the error

enter image description here

How to solve it?

My config/environments/development.rb

Rails.application.configure do

  config.secret_key_base = ENV["SECRET_KEY_BASE"]

  #Some stuff 

end

And I don't have the secret.yml file in my folder.

enter image description here

like image 499
Alex Shmatko Avatar asked Sep 04 '15 12:09

Alex Shmatko


3 Answers

Then create one:

config/secrets.yml

# be sure to restart your server when you modify this file...
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
development:
  secret_key_base:  asdflkjasdlfkjasldfkj

test:
  secret_key_base:  asdflkhasldfhlhaskdlflakhsdf

production:
  secret_key_base: 523lk5h2lkjlj6nlk4n6lk4

obviously don't use those keys above ^ just mash on your keyboard, or use rake secret to generate one :)

like image 161
ddavison Avatar answered Oct 22 '22 16:10

ddavison


You skipped one installation step.

For Redmine 2 and 3 versions, type:

RAILS_ENV=production bundle exec rake generate_secret_token
like image 2
Aleksandar Pavić Avatar answered Oct 22 '22 15:10

Aleksandar Pavić


The following solution helped me:

Create a secrets.yml file in your config directory.

In your terminal, type the following command: rake secret. This will generate a secret for you to include in your secrets.yml file.

Add the following snippet of code to your config/secrets.yml file:

development: secret_key_base: PASTE_YOUR_GENERATED_SECRET_HERE

like image 1
Atchutha rama reddy Karri Avatar answered Oct 22 '22 17:10

Atchutha rama reddy Karri