MCPcopy Create free account
hub / github.com/subquery/subql / buildSequelizeOptions

Function buildSequelizeOptions

packages/node-core/src/db/db.module.ts:61–87  ·  view source on GitHub ↗
(nodeConfig: NodeConfig, option: DbOption)

Source from the content-addressed store, hash-verified

59};
60
61const buildSequelizeOptions = (nodeConfig: NodeConfig, option: DbOption): SequelizeOption => {
62 const logger = getLogger('SQL');
63
64 return {
65 ...option,
66 dialect: 'postgres',
67 ssl: nodeConfig.isPostgresSecureConnection,
68 dialectOptions: {
69 ssl: {
70 rejectUnauthorized: false,
71 ca: nodeConfig.postgresCACert,
72 key: nodeConfig.postgresClientKey,
73 cert: nodeConfig.postgresClientCert,
74 },
75 },
76 pool: {
77 max: nodeConfig.pgPoolMax,
78 min: nodeConfig.pgPoolMin,
79 acquire: nodeConfig.pgPoolAqcuire,
80 idle: nodeConfig.pgPoolIdle,
81 evict: nodeConfig.pgPoolEvict,
82 },
83 logging: (sql: string, timing?: number) => {
84 logger.debug(sql);
85 },
86 };
87};
88
89export async function establishNewSequelize(nodeConfig: NodeConfig): Promise<Sequelize> {
90 return sequelizeFactory(buildSequelizeOptions(nodeConfig, DEFAULT_DB_OPTION))();

Callers 3

establishNewSequelizeFunction · 0.85
forRootWithConfigMethod · 0.85
forRootMethod · 0.85

Calls 2

getLoggerFunction · 0.90
debugMethod · 0.45

Tested by

no test coverage detected