new(kb.gblib): added postgres.
This commit is contained in:
parent
284cdac428
commit
4be13899f5
2 changed files with 12 additions and 4 deletions
|
@ -102,6 +102,7 @@
|
||||||
"@semantic-release/git": "10.0.1",
|
"@semantic-release/git": "10.0.1",
|
||||||
"@sendgrid/mail": "8.1.3",
|
"@sendgrid/mail": "8.1.3",
|
||||||
"@sequelize/core": "7.0.0-alpha.37",
|
"@sequelize/core": "7.0.0-alpha.37",
|
||||||
|
"@sequelize/postgres": "^7.0.0-alpha.43",
|
||||||
"@types/node": "22.5.2",
|
"@types/node": "22.5.2",
|
||||||
"@types/validator": "13.12.1",
|
"@types/validator": "13.12.1",
|
||||||
"adm-zip": "0.5.16",
|
"adm-zip": "0.5.16",
|
||||||
|
|
|
@ -39,6 +39,7 @@ import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||||
import { ScheduleServices } from './ScheduleServices.js';
|
import { ScheduleServices } from './ScheduleServices.js';
|
||||||
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
||||||
import urlJoin from 'url-join';
|
import urlJoin from 'url-join';
|
||||||
|
import { PostgresDialect } from '@sequelize/postgres';
|
||||||
import { NodeVM, VMScript } from 'vm2';
|
import { NodeVM, VMScript } from 'vm2';
|
||||||
import { createVm2Pool } from './vm2-process/index.js';
|
import { createVm2Pool } from './vm2-process/index.js';
|
||||||
import { watch } from 'fs';
|
import { watch } from 'fs';
|
||||||
|
@ -250,7 +251,7 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
const encrypt: boolean = GBConfigService.get('STORAGE_ENCRYPT') === 'true';
|
const encrypt: boolean = GBConfigService.get('STORAGE_ENCRYPT') === 'true';
|
||||||
const acquire = parseInt(GBConfigService.get('STORAGE_ACQUIRE_TIMEOUT'));
|
const acquire = parseInt(GBConfigService.get('STORAGE_ACQUIRE_TIMEOUT'));
|
||||||
const sequelizeOptions = {
|
let sequelizeOptions = {
|
||||||
define: {
|
define: {
|
||||||
charset: 'utf8',
|
charset: 'utf8',
|
||||||
collate: 'utf8_general_ci',
|
collate: 'utf8_general_ci',
|
||||||
|
@ -278,8 +279,14 @@ export class GBVMService extends GBService {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (dialect === 'postgres') {
|
||||||
|
sequelizeOptions['ssl'] = true;
|
||||||
|
sequelizeOptions['clientMinMessages'] = 'notice';
|
||||||
|
sequelizeOptions['dialect']= PostgresDialect;
|
||||||
|
}
|
||||||
|
|
||||||
if (!min[connectionName]) {
|
if (!min[connectionName]) {
|
||||||
GBLogEx.info(min, `Loading data connection ${connectionName}...`);
|
GBLogEx.info(min, `Loading data connection ${connectionName} (${dialect})...`);
|
||||||
min[connectionName] = new Sequelize(storageName, username, password, sequelizeOptions);
|
min[connectionName] = new Sequelize(storageName, username, password, sequelizeOptions);
|
||||||
min[connectionName]['gbconnection'] = con;
|
min[connectionName]['gbconnection'] = con;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue