Database
Path: packages/db/src/config.ts
Connection info is defined per-environment and per-database.
System consists of two databases:
Foods
- food-related information, mostly static contentSystem
- users / surveys related information, system configuration etc
Environments:
development
- local development environmenttest
- local tests and CI environmentproduction
- production environment
Connection types
- Connection URL - use
url
property - Connection credentials - use
host
,port
,database
,username
andpassword
properties
URL
- object-path:
[environment][database].url
- dotenv vars:
development
:DB_DEV_FOODS_URL
andDB_DEV_SYSTEM_URL
test
:DB_TEST_FOODS_URL
andDB_TEST_SYSTEM_URL
production
:DB_FOODS_URL
andDB_SYSTEM_URL
- type:
string | undefined
- default:
undefined
Host
- object-path:
[environment][database].host
- dotenv vars:
development
:DB_DEV_FOODS_HOST
andDB_DEV_SYSTEM_HOST
test
:DB_TEST_FOODS_HOST
andDB_TEST_SYSTEM_HOST
production
:DB_FOODS_HOST
andDB_SYSTEM_HOST
- type:
string | undefined
- default:
undefined
Port
- object-path:
[environment][database].port
- dotenv vars:
development
:DB_DEV_FOODS_PORT
andDB_DEV_SYSTEM_PORT
test
:DB_TEST_FOODS_PORT
andDB_TEST_SYSTEM_PORT
production
:DB_FOODS_PORT
andDB_SYSTEM_PORT
- type:
number | undefined
- default:
undefined
Database
- object-path:
[environment][database].database
- dotenv vars:
development
:DB_DEV_FOODS_DATABASE
andDB_DEV_SYSTEM_DATABASE
test
:DB_TEST_FOODS_DATABASE
andDB_TEST_SYSTEM_DATABASE
production
:DB_FOODS_DATABASE
andDB_SYSTEM_DATABASE
- type:
string | undefined
- default:
undefined
Username
- object-path:
[environment][database].username
- dotenv vars:
development
:DB_DEV_FOODS_USERNAME
andDB_DEV_SYSTEM_USERNAME
test
:DB_TEST_FOODS_USERNAME
andDB_TEST_SYSTEM_USERNAME
production
:DB_FOODS_USERNAME
andDB_SYSTEM_USERNAME
- type:
string | undefined
- default:
undefined
Password
- object-path:
[environment][database].password
- dotenv vars:
development
:DB_DEV_FOODS_PASSWORD
andDB_DEV_SYSTEM_PASSWORD
test
:DB_TEST_FOODS_PASSWORD
andDB_TEST_SYSTEM_PASSWORD
production
:DB_FOODS_PASSWORD
andDB_SYSTEM_PASSWORD
- type:
string | undefined
- default:
undefined
Dialect
- object-path:
[environment][database].dialect
- dotenv vars:
development
:DB_DEV_FOODS_DRIVER
andDB_DEV_SYSTEM_DRIVER
test
:DB_TEST_FOODS_DRIVER
andDB_TEST_SYSTEM_DRIVER
production
:DB_FOODS_DRIVER
andDB_SYSTEM_DRIVER
- type:
'mysql' | 'postgres' | 'sqlite' | 'mariadb' | 'mssql'
- default:
'postgres'
Security
- object-path:
[environment].security
- dotenv vars:
development
:DB_CONNECTION_SSL
test
:DB_CONNECTION_SSL
production
:DB_CONNECTION_SSL
- type:
'true' | 'false'
- default:
'true'