no password provided rails 6 with RAILS_ENV=production

113 views Asked by At

i try to put my rails api into digital oceans server with nginx and passenger, so far i got it working but when i try to send a request with postman to my server i have a 500 internal error after checking log/production.log, the 500 internal error is due to ActiveRecord::ConnectionNotEstablished (fe_sendauth: no password supplied This is weird because RAILS_ENV=production rails db:setup is working,i have my master.key for credentials and secret_key_base is in it, environnement variable in my bashrc for username database and password database. when i do RAILS_ENV=production rails c i can see my ENV["MYAPP_DATABASE_USER"] still in my rails console in production mode i can do Rails.application.credentials.secret_key_base she is there !

postgres user is set correctly with the same password i supply to rails.. maybe its passenger who is not working properly... but i don't know how to properly check it.

EDIT : PROBLEM SOLVE

i was able to solve my problem passing my env variable to nginx like this in /etc/nginx/sites-enabled/myapp.conf

passenger_env_var KEY VALUE;

passenger doc's say that he is reading the bashrc file for env variable ... but its ok like that hope its help some dude over here hehe ;)

0

There are 0 answers