Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6999269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:31:10+00:00 2026-05-27T20:31:10+00:00

I have the following developement section of my development.yml file: development: adapter: postgresql host:

  • 0

I have the following developement section of my development.yml file:

development:
  adapter: postgresql
  host: localhost
  database: testtb
  username: app_user
  password: ENV['APP_USER_POSTGRES_PASSWORD']     <= Troublesome line

When I open a rails console via bundle exec rails console and type ENV['APP_USER_POSTGRES_PASSWORD'] I get back the DB password I’ve specified in my local profile. However, when I start my rails server, it can’t connect to the DB, failing with

PGError FATAL:  password authentication failed for user "app_user"

This was previously working when I had the DB password actually typed out in plain text, rather than trying to access it via ENV['...'], but for obvious reasons I want to keep the actual password out of this file entirely (and therefore out of the code repository) while still being able to commit other, non-secure changes to the database.yml file.

Is there something special about the syntax I’m missing, or are the environment variables for some reason not available when the database.yml file is being loaded?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:31:11+00:00Added an answer on May 27, 2026 at 8:31 pm

    Update: Some people report in the comments that this doesn’t work as of Rails 4.2.x.x. I haven’t tried it myself, so YMMV.


    Ah, finally figured out the simple solution – it accepts embedded Ruby:

    password: <%= ENV['APP_USER_POSTGRES_PASSWORD'] %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my bootstrap.php I have the following: if($_SERVER['SERVER_NAME'] == 'localhost') Kohana::$environment = 'development'; else
I have the following scenario: We have stored procedures which compare our developement database
I have the following virtual host on my development server: <VirtualHost *:80> ServerName example.com
I just started using django for development. At the moment, I have the following
Imagine following scenario: We have a lot of parallel development going on in several
I have following text in a file 23456789 When I tried to replace the
All, I have a config xml file in the following format: <?xml version=1.0?> <configdata>
When doing developement for linux, I have a file for vim that changes the
I have been following the iPhone development videos on iTunes U and so far
In development I use jetty as the servlet container. I have the following development

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.