Open gustavohenke opened 9 years ago
Hi, I was thinking of some sort of integration with phpdotenv but I'm not quite sure how. Do you have any examples of how you'd like to use it?
That's how it works with that Node module:
custom-environment-variables.yml
db:
# For Codeship
username: PG_USER
password: PG_PASSWORD
# For Heroku
url: DATABASE_URL
Then, my db.username
and db.password
configs are overriden by Codeship env vars, and db.url
is overriden by Heroku env vars.
This seems a bit overkill for this package, because (AFAIK) we'll have to check the value of each configuration value to see if it matches an environment variable. I hope I'm wrong and there's a better way of doing it.
Just an update, this can be done in PHP using the dotenv package - still not sure about other file formats though
If you use php as config file, you can load env variables like this:
<?php
return [
'some_config_parameter' => getenv('SOME_ENV_PARAMETER')
];
It could be interesting to have something like Symfony, reading the .env file and filling variables. For example:
db:
driver: mariadb
username: '%env(DB_USERNAME)%'
password: '%env(DB_PASSWORD)%'
Hey, I'm a Node.js developer which needs to program an app using PHP for college! So I thought of using this config manager, which is very alike with node-config.
But I want to override a few options with environment variables, because of Heroku, for example. node-config allows me to do this via an special
custom-environment-variables
configuration.What do you think of implementing something similar in your amazing project?