Skip to content

Instantly share code, notes, and snippets.

@headwinds
Created June 16, 2021 12:54
Show Gist options
  • Save headwinds/b48ee5aebc74f2858466b0f02a26c359 to your computer and use it in GitHub Desktop.
Save headwinds/b48ee5aebc74f2858466b0f02a26c359 to your computer and use it in GitHub Desktop.
serverless postgreSQL config
import { Dialect } from 'sequelize/types';
export const config = {
database: {
dialect: 'postgres' as Dialect,
host: 'ruby.db.elephantsql.com',
port: 5432,
username: 'your-username-here',
password: 'your-password-here',
database: 'your-database-here',
logging: false,
ssl: true,
pool: {
maxConnections: 1,
maxIdleTime: 1000,
},
retry: {
match: [
/ConnectionError/,
/SequelizeConnectionError/,
/SequelizeConnectionRefusedError/,
/SequelizeHostNotFoundError/,
/SequelizeHostNotReachableError/,
/SequelizeInvalidConnectionError/,
/SequelizeConnectionTimedOutError/,
/SequelizeConnectionAcquireTimeoutError/,
/Connection terminated unexpectedly/,
],
max: Infinity,
},
synchronize: false,
migrationsRun: true,
migrations: [__dirname + '/migrations/**/*{.ts,.js}'],
cli: {
migrationsDir: 'db/migrations',
},
},
jwtPrivateKey: 'razzle-dazzle',
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment