fix(services): remove unnecessary comments and improve URL configuration in GBCoreService and GBMinService
All checks were successful
GBCI / build (push) Successful in 5m13s
All checks were successful
GBCI / build (push) Successful in 5m13s
This commit is contained in:
parent
98e6badbb2
commit
1b6dcb061b
2 changed files with 13 additions and 8 deletions
|
|
@ -129,12 +129,12 @@ export class GBCoreService implements IGBCoreService {
|
||||||
let password: string | undefined;
|
let password: string | undefined;
|
||||||
let storage: string | undefined;
|
let storage: string | undefined;
|
||||||
|
|
||||||
// Validar o dialeto
|
|
||||||
if (!['mssql', 'postgres', 'sqlite'].includes(this.dialect)) {
|
if (!['mssql', 'postgres', 'sqlite'].includes(this.dialect)) {
|
||||||
throw new Error(`Unknown or unsupported dialect: ${this.dialect}.`);
|
throw new Error(`Unknown or unsupported dialect: ${this.dialect}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configurações específicas para cada dialeto
|
|
||||||
if (this.dialect === 'mssql' || this.dialect === 'postgres') {
|
if (this.dialect === 'mssql' || this.dialect === 'postgres') {
|
||||||
host = GBConfigService.get('STORAGE_SERVER');
|
host = GBConfigService.get('STORAGE_SERVER');
|
||||||
database = GBConfigService.get('STORAGE_NAME');
|
database = GBConfigService.get('STORAGE_NAME');
|
||||||
|
|
@ -159,7 +159,7 @@ export class GBCoreService implements IGBCoreService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuração de logging
|
|
||||||
const logging: boolean | Function =
|
const logging: boolean | Function =
|
||||||
GBConfigService.get('STORAGE_LOGGING') === 'true'
|
GBConfigService.get('STORAGE_LOGGING') === 'true'
|
||||||
? (str: string): void => {
|
? (str: string): void => {
|
||||||
|
|
@ -167,14 +167,14 @@ export class GBCoreService implements IGBCoreService {
|
||||||
}
|
}
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
// Configuração de encrypt (específico para MSSQL)
|
|
||||||
const encrypt: boolean = GBConfigService.get('STORAGE_ENCRYPT') === 'true';
|
const encrypt: boolean = GBConfigService.get('STORAGE_ENCRYPT') === 'true';
|
||||||
|
|
||||||
// Configuração do pool
|
|
||||||
const acquireStr = GBConfigService.get('STORAGE_ACQUIRE_TIMEOUT');
|
const acquireStr = GBConfigService.get('STORAGE_ACQUIRE_TIMEOUT');
|
||||||
const acquire = acquireStr ? parseInt(acquireStr, 10) : 10000; // Valor padrão de 10 segundos
|
const acquire = acquireStr ? parseInt(acquireStr, 10) : 10000; // Valor padrão de 10 segundos
|
||||||
|
|
||||||
// Configuração do Sequelize
|
|
||||||
const sequelizeOptions: SequelizeOptions = {
|
const sequelizeOptions: SequelizeOptions = {
|
||||||
define: {
|
define: {
|
||||||
freezeTableName: true,
|
freezeTableName: true,
|
||||||
|
|
@ -201,7 +201,7 @@ export class GBCoreService implements IGBCoreService {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inicializar o Sequelize
|
|
||||||
this.sequelize = new Sequelize(database, username, password, sequelizeOptions);
|
this.sequelize = new Sequelize(database, username, password, sequelizeOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -731,7 +731,12 @@ export class GBMinService {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GBConfigService.get('GB_MODE') !== 'legacy') {
|
if (GBConfigService.get('GB_MODE') !== 'legacy') {
|
||||||
config['domain'] = `http://localhost:${GBConfigService.get('PORT')}/directline/${botId}`;
|
const url =
|
||||||
|
process.env.BOT_URL ||
|
||||||
|
`http://localhost:${GBConfigService.get('PORT')}`;
|
||||||
|
|
||||||
|
config['domain'] = urlJoin(url, 'directline', botId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const webchatTokenContainer = await this.getWebchatToken(instance);
|
const webchatTokenContainer = await this.getWebchatToken(instance);
|
||||||
config['conversationId'] = webchatTokenContainer.conversationId;
|
config['conversationId'] = webchatTokenContainer.conversationId;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue