feat: mix yml with salix

This commit is contained in:
Javier Segarra 2024-04-25 08:19:28 +02:00
parent be89b664aa
commit a376c888d9
2 changed files with 23 additions and 14 deletions

View File

@ -20,6 +20,11 @@ module.exports = class ModelLoader {
schemaMap,
logMap
});
if(!conf.logs ) conf.logs = {}
Object.keys(conf.logs??{}).length > 0 && console.warn('‼️ - Existen modelos NO exportados')
Object.assign(conf.logs, logs)
for (const logName in conf.logs) {
const logConf = conf.logs[logName];

View File

@ -12,34 +12,38 @@ module.exports = class Salix {
}
async fetch(path) {
let salixCall = await fetch(`${this.conf.salix.url}/${path}`, {
method: "GET",
});
const response = JSON.parse(await salixCall.text());
if (salixCall.status !== 200) {
console.error(response.error);
throw new Error(response.error.message);
try {
let salixCall = await fetch(`${this.conf.salix.url}/${path}`, {
method: "GET",
});
const response = JSON.parse(await salixCall.text());
if (salixCall.status !== 200) {
console.error(response.error);
throw new Error(response.error.message);
}
this._salixVersion = salixCall.headers.get("Salix-version");
return response;
} catch (error) {
throw new Error(error.message);
}
this._salixVersion = salixCall.headers.get("Salix-version");
return response;
}
async getSalixVersion() {
log("CHECK VERSION");
this.log("CHECK VERSION");
const salixVersion = await this.fetch("applications/version");
if (this._salixVersion !== salixVersion) fetch();
log("VERSION CHECKED");
this.log("VERSION CHECKED");
}
async salixLogInfo() {
log("LOGINFO REQUEST");
this.log("LOGINFO REQUEST");
let salixLogConfig = await this.fetch("schemas/logInfo");
this._logInfo = [salixLogConfig];
this._logInfo = salixLogConfig;
log("LOGINFO REQUESTED");
this.log("LOGINFO REQUESTED");
}
log(param) {