Is it possible to set ENV variables for rails development environment in my code?

后端 未结 7 1209
心在旅途
心在旅途 2020-11-27 09:59

I know that I can set my ENV variables in bash via

export admin_password = \"secret\"

But is there a way to do it in my rails source code s

7条回答
  •  萌比男神i
    2020-11-27 10:13

    As an aside to the solutions here, there are cleaner alternatives if you're using certain development servers.

    With Heroku's Foreman, you can create per-project environment variables in a .env file:

    ADMIN_PASSOWRD="secret"
    

    With Pow, you can use a .powenv file:

    export ADMIN_PASSOWRD="secret"
    

提交回复
热议问题