You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There had been many feedbacks on the framework configuration (#743, #735, #497, #788, #428, #803, Discord). Current system is not great and does not meet all the needs as it should be.
What can be improved
The link between the environment variable XXX_YYY_ZZZ and Config.get('xxx.yyy.zzz') (or Config.get('xxx.yyyZzz')) is confusing and not intuitive.
It is not possible to access directly an environment variable defined in a .env file (unlike the library dotenv).
Some components of the framework require specific environment variable names (ex: REDIS_URI, MONGODB_URI) which is annoying when the PaaS we have use different names.
It is not possible to add comments or use quotes in the .env.
It is not possible to specify JWT RSA public/private keys from .pem files.
It it is not possible to divide very large config files in sub-files and sub-directories.
What should be kept
Be able to specify configuration in YAML and JSON files.
Have a unified way in the framework to access the configuration values (especially for the framework std components).
Be able to play with different environments.
Do not override the process.env.{variable} to avoid unexpected errors in 3p libraries and to be able to use other types than the string one.
Solutions
Add these changes/improvements to the configuration system.
1. Support JS files
In addition to YAML and JSON formats, the framework will support .js files.
2. Have access to .env variables and the environment variables in config files
Issue
There had been many feedbacks on the framework configuration (#743, #735, #497, #788, #428, #803, Discord). Current system is not great and does not meet all the needs as it should be.
What can be improved
Config.get('xxx.yyy.zzz')
(orConfig.get('xxx.yyyZzz')
) is confusing and not intuitive..env
file (unlike the library dotenv).REDIS_URI
,MONGODB_URI
) which is annoying when the PaaS we have use different names..env
..pem
files.What should be kept
process.env.{variable}
to avoid unexpected errors in 3p libraries and to be able to use other types than thestring
one.Solutions
Add these changes/improvements to the configuration system.
1. Support JS files
In addition to YAML and JSON formats, the framework will support
.js
files.2. Have access to .env variables and the environment variables in config files
In YAML:
In JSON:
In JS:
3. Remove the links between XXX_YYY_ZZZ and
Config.get('xxx.yyy.zzz')
The link must be set explicitly in the config file:
4. Support comments and quotes in .env files
Example of pretty printed errors in v2
ConfigNotFound
ConfigTypeError
Comparison with other frameworks (refenrences)
https://guides.rubyonrails.org/configuring.html
https://symfony.com/doc/current/configuration.html
https://docs.djangoproject.com/en/3.0/topics/settings/
https://adonisjs.com/docs/4.0/configuration-and-env
https://laravel.com/docs/7.x/configuration
The text was updated successfully, but these errors were encountered: