Simulated environment
An environment to simulate an actual real-world scenario.
test-database:
image: postgres
restart: always
ports:
- ${DATABASE_PORT}:5432
environment:
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}"pretest:e2e": "docker-compose --env-file .env.test.local up -d test-database",
"posttest:e2e": "docker-compose --env-file .env.test.local stop test-database && docker-compose --env-file .env.test.local rm -fv test-database",export default registerAs('testDatabase', () => {
const user = process.env.DATABASE_USER;
const password = process.env.DATABASE_PASSWORD;
const host = process.env.DATABASE_HOST;
const port = process.env.DATABASE_PORT;
const name = process.env.DATABASE_NAME;
const url = `postgresql://${user}:${password}@${host}:${port}/${name}`;
const config = {
type: 'postgres',
url,
autoLoadEntities: true,
synchronize: true,
} as const satisfies TypeOrmModuleOptions;
return config;
});Last updated