Skip to content

Instantly share code, notes, and snippets.

@rkkautsar
Created March 20, 2018 16:51
Show Gist options
  • Save rkkautsar/567d16b0986b00aeb467b31e9cb09cbb to your computer and use it in GitHub Desktop.
Save rkkautsar/567d16b0986b00aeb467b31e9cb09cbb to your computer and use it in GitHub Desktop.
const CI_DATABASE_URL = 'postgres://test:test@postgres:5432/test';
const base = {
type: 'postgres',
url: process.env.DATABASE_URL,
schema: 'public',
synchronize: false,
logging: false,
entities: ['src/entity/*.ts'],
migrations: ['src/migration/*.ts'],
subscribers: ['src/subscriber/*.ts'],
cli: {
entitiesDir: 'src/entity',
migrationsDir: 'src/migration',
subscribersDir: 'src/subscriber'
},
migrationsRun: true
};
const config = {
test: {
url: process.env.CI ? CI_DATABASE_URL : process.env.DATABASE_TEST_URL,
dropSchema: true
},
development: {},
production: {
dropSchema: false
}
};
module.exports = process.env.CI
? { ...base, ...config['test'] }
: { ...base, ...config[process.env.NODE_ENV || 'development'] };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment