Score:0

I can't verify that the environment variable “SECRET_KEY_BASE” is properly set in Linux

cn flag

My ruby ​​version is 2.6.6, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my bundler version is 2.2.21, my rails version is 5.0.7.2, and my Xcode version is 12.5.

I use macOS Big Sur(version 11.4) and the text editor "Atom".

I'm planning to release my Rails application with the URL of HEROKU(example. https://[My APP Name].herokuapp.com).

I ran the following command.

$ heroku open

The following error occured.

An unhandled lowlevel error occurred. The application logs may have details.

I set two environment variables as below with this command: $ heroku config:set [ENVIRONMENT VARIABLE NAME].

$ heroku config:set DATABASE_USERNAME=****
$ heroku config:set DATABASE_PASSWORD=****

I ran the following command.

$ heroku config

DATABASE_PASSWORD: ****
DATABASE_URL: postgres://****
DATABASE_USERNAME: ****
HEROKU_POSTGRESQL_AQUA_URL: postgres://****
HEROKU_POSTGRESQL_BLACK_URL: postgres://****
LANG: en_US.UTF-8
RACK_ENV: production
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: enabled
RAILS_SERVE_STATIC_FILES: enabled

I ran the following command to get GENERATED_CODE.

$ RAILS_ENV=production rake secret

GENERATED_CODE

I ran the following command.

$ vi /etc/profile

I set the environment variable SECRET_KEY_BASE as below in Vim editor.

# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
        [ -r /etc/bashrc ] && . /etc/bashrc
fi

$ export SECRET_KEY_BASE=GENERATED_CODE

I saved the above SECRET_KEY_BASE and ended Vim editor with the two below commands.

:w !sudo tee %
:q!

I ran the two following command for verifying that the environment variable SECRET_KEY_BASE is properly set in Linux.

$ printenv | grep SECRET_KEY_BASE
$ echo $SECRET_KEY_BASE

But I can't verify that the environment variable SECRET_KEY_BASE is properly set with either of the above commands.

muru avatar
us flag
Did you really include the `$` in `$ export ...` in `/etc/profile`? Also, did you login again after editing it?
Artur Meinild avatar
vn flag
I shortened your post a bit by removing repeating information.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.