feat: Adding `DEV`, `PROD`, `TEST` environment variables
I would like to be able to change the code of my application using env variables, eg change the port based on which mode the FOCA app is running or change the configuration etc. This might seem like a per project level requirement, but having this defined either in config.yaml with strict typing to standardize the variable name might be helpful.
For example being able to do something like:
# Development: Permissive CORS
if app.mode == APIMode.DEV:
CORS(app, origins="*")
# Production: Strict CORS
if app.mode == APIMode.PROD:
CORS(app, origins=["https://myapp.com"])
Maybe extra configs for those modes in config.yaml, with which we can overwrite some config fields.
environments:
dev:
server:
debug: True
port: 8080
use_reloader: True
db:
host: localhost
port: 27017
prod:
server:
debug: False
port: 80
use_reloader: False
log:
root:
level: 20
handlers:
console:
level: 20
staging:
server:
debug: False
port: 8080
Do you want to have bifurcation on the basis of different config files or a single config file? While I understand the need to such particulars, we might need to think on adding such support from a more holistic perspective as to have a long term solution based on scope and requirements. I like the idea of have a dedicated config for prod staging etc, but do we want to think in some additional directions as well? As to have a boiler plate based on different config files or to move such variables and abstract them out? Any additional thoughts?