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
urlproperty - Connection credentials - use
host,port,database,usernameandpasswordproperties
URL
Examples
DB_DEV_SYSTEM_URL=postgres://user:password@localhost:5432/intake24_system_dev
DB_DEV_FOODS_URL=postgres://user:password@localhost:5432/intake24_foods_dev
- object-path:
[environment][database].url - dotenv vars:
development:DB_DEV_FOODS_URLandDB_DEV_SYSTEM_URLtest:DB_TEST_FOODS_URLandDB_TEST_SYSTEM_URLproduction:DB_FOODS_URLandDB_SYSTEM_URL
- type:
string | undefined - default:
undefined
Host
- object-path:
[environment][database].host - dotenv vars:
development:DB_DEV_FOODS_HOSTandDB_DEV_SYSTEM_HOSTtest:DB_TEST_FOODS_HOSTandDB_TEST_SYSTEM_HOSTproduction:DB_FOODS_HOSTandDB_SYSTEM_HOST
- type:
string | undefined - default:
undefined
Port
- object-path:
[environment][database].port - dotenv vars:
development:DB_DEV_FOODS_PORTandDB_DEV_SYSTEM_PORTtest:DB_TEST_FOODS_PORTandDB_TEST_SYSTEM_PORTproduction:DB_FOODS_PORTandDB_SYSTEM_PORT
- type:
number | undefined - default:
undefined
Database
- object-path:
[environment][database].database - dotenv vars:
development:DB_DEV_FOODS_DATABASEandDB_DEV_SYSTEM_DATABASEtest:DB_TEST_FOODS_DATABASEandDB_TEST_SYSTEM_DATABASEproduction:DB_FOODS_DATABASEandDB_SYSTEM_DATABASE
- type:
string | undefined - default:
undefined
Username
- object-path:
[environment][database].username - dotenv vars:
development:DB_DEV_FOODS_USERNAMEandDB_DEV_SYSTEM_USERNAMEtest:DB_TEST_FOODS_USERNAMEandDB_TEST_SYSTEM_USERNAMEproduction:DB_FOODS_USERNAMEandDB_SYSTEM_USERNAME
- type:
string | undefined - default:
undefined
Password
- object-path:
[environment][database].password - dotenv vars:
development:DB_DEV_FOODS_PASSWORDandDB_DEV_SYSTEM_PASSWORDtest:DB_TEST_FOODS_PASSWORDandDB_TEST_SYSTEM_PASSWORDproduction:DB_FOODS_PASSWORDandDB_SYSTEM_PASSWORD
- type:
string | undefined - default:
undefined
Dialect
- object-path:
[environment][database].dialect - dotenv vars:
development:DB_DEV_FOODS_DRIVERandDB_DEV_SYSTEM_DRIVERtest:DB_TEST_FOODS_DRIVERandDB_TEST_SYSTEM_DRIVERproduction:DB_FOODS_DRIVERandDB_SYSTEM_DRIVER
- type:
'mysql' | 'postgres' | 'sqlite' | 'mariadb' | 'mssql' - default:
'postgres'
Security
In developement environment, DB_CONNECTION_SSL can set to false to skip using SSL protocol.
- object-path:
[environment].security - dotenv vars:
development:DB_CONNECTION_SSLtest:DB_CONNECTION_SSLproduction:DB_CONNECTION_SSL
- type:
'true' | 'false' - default:
'true'