Alexander Shmatko Alexander Shmatko - 29 days ago 9
Ruby Question

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

Answer

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 :)

Comments