.env and Docker Container Environment - potential problems |
Just a sanity-check to see if I am missing something.
In a recent project I packaged a CI4 application into a Docker (php:7.3.26-apache-stretch image) and uploaded it to AWS FARGATE. In the application I use .env to configure stuff like database settings: PHP Code: database.default.hostname = localhost After googling around I came to the conclusion that it is a combination of issues here but the main culprit is the bash-shell (which Ubuntu is using, which is the base of the Docker image) defining variable names as strictly alphanumeric and underscore - dot is not allowed! The work-around I have now is to use legal variable names and then in app/Config/Database.php::__construct() do this: PHP Code: if (getenv('DATABASE_HOSTNAME')) { My question now - is there a better way? /Mattias Ah, and by the way: I also ran into another problem for some reason, variables return the wrong value using getenv() - https://github.com/codeigniter4/CodeIgni...ssues/3992 |
Messages In This Thread |
.env and Docker Container Environment - potential problems - by tgix - 01-11-2021, 12:45 AM
RE: .env and Docker Container Environment - potential problems - by kenjis - 01-19-2021, 05:10 PM
|