.env configuration
Garvan loads runtime configuration from a .env file at the project root. Anything you can put in a shell environment, you can put here — with one exception: variable interpolation works inside the file itself, so you can compose a database URL from its parts.
Loading the file
The file is read automatically when the app starts. Each line is KEY=VALUE; lines starting with # are comments. A working example shipped with the starter:
DATABASE_TYPE=postgres
DATABASE_NAME=dbname
DATABASE_USER=dbuser
DATABASE_PASSWORD=password
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DATABASE_SSL_MODE=disable
DATABASE_URL="$DATABASE_TYPE://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME?sslmode=$DATABASE_SSL_MODE"
Common variables
DATABASE_TYPE— one ofpostgres,mysql,sqlite,mongodb,monetdb.DATABASE_URL— a full connection URL. The query builder uses this if present.APP_PORT— HTTP port; defaults to 9090.APP_ENV—developmentorproduction— controls log level defaults.
Warning
Never commit your .env to version control — only the example file (.env.example). Add .env to .gitignore.