1

If I'm not wrong, it seems like defined with Figaro variables are not available in Docker container. I have env files to configure Postgresq DB: POSTGRES_USER=ENV['db_user'] POSTGRES_PASSWORD=ENV['db_password] POSTGRES_DB=ENV['db_name'] I have application.yml file copied with all the other Rails app files to the container (I could check it with ls in the container shell).

Is it a normal behaviour ?

Promise Preston
  • 24,334
  • 12
  • 145
  • 143
belgoros
  • 3,590
  • 7
  • 38
  • 76

1 Answers1

0

I also faced this issue when working on a Rails application.

The thing to note here is that for Docker, environment variables are placed in a .env file or an env_file (my_variables.env). Environment files placed in .yml or .yaml files (application.yml) are not often recognized by Docker during runtime. Here's a link to Docker's official documentation that further explains it: The “.env” file

An example of such environment variables are Database connection strings which are required during the application startup process like:

database_name
database_username
database_password

However, you can still use the Figaro gem for defining variables that are not required during application startup, like:

RAILS_MASTER_KEY

That's all.

I hope this helps

Promise Preston
  • 24,334
  • 12
  • 145
  • 143