feat: Add CI configuration for backend tests
This commit is contained in:
@@ -3,14 +3,12 @@ HOST=localhost
|
||||
PROTOCOL=http
|
||||
PORT=3000
|
||||
LOG_LEVEL=debug
|
||||
WEBHOOK_SECRET_KEY=secret
|
||||
ENCRYPTION_KEY=sample_encryption_key
|
||||
WEBHOOK_SECRET_KEY=sample_webhook_secret_key
|
||||
APP_SECRET_KEY=sample_app_secret_key
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_DATABASE=automatisch_test
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_USERNAME=automatisch_test_user
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_ENABLE_SSL=false
|
||||
ENCRYPTION_KEY=secret
|
||||
APP_SECRET_KEY=secret
|
||||
REDIS_PORT=6379
|
||||
REDIS_HOST=127.0.0.1
|
||||
POSTGRES_PASSWORD=automatisch_test_user_password
|
||||
REDIS_HOST=localhost
|
||||
|
@@ -55,6 +55,7 @@ type AppConfig = {
|
||||
paddlePublicKey: string;
|
||||
licenseKey: string;
|
||||
sentryDsn: string;
|
||||
CI: boolean;
|
||||
};
|
||||
|
||||
const host = process.env.HOST || 'localhost';
|
||||
@@ -131,6 +132,7 @@ const appConfig: AppConfig = {
|
||||
paddlePublicKey: process.env.PADDLE_PUBLIC_KEY,
|
||||
licenseKey: process.env.LICENSE_KEY,
|
||||
sentryDsn: process.env.SENTRY_DSN,
|
||||
CI: process.env.CI === 'true',
|
||||
};
|
||||
|
||||
if (!appConfig.encryptionKey) {
|
||||
|
@@ -2,9 +2,13 @@ import './check-env-file';
|
||||
import { createDatabaseAndUser } from '../../bin/database/utils';
|
||||
import { client as knex } from '../../src/config/database';
|
||||
import logger from '../../src/helpers/logger';
|
||||
import appConfig from '../../src/config/app';
|
||||
|
||||
const createAndMigrateDatabase = async () => {
|
||||
await createDatabaseAndUser();
|
||||
if (!appConfig.CI) {
|
||||
await createDatabaseAndUser();
|
||||
}
|
||||
|
||||
const migrator = knex.migrate;
|
||||
|
||||
await migrator.latest();
|
||||
|
Reference in New Issue
Block a user