feat: fetch modelInfo
gitea/mylogger/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2025-04-08 14:44:34 +02:00
parent 011ed225a2
commit fd57221ea8
1 changed files with 6 additions and 6 deletions

View File

@ -142,11 +142,12 @@ module.exports = class Salix {
`${this.conf.salix.url}/${path}`, `${this.conf.salix.url}/${path}`,
fetchConfig fetchConfig
); );
if (salixCall.status !== 200) {
throw new Error(response);
}
const responseText = await salixCall.text(); const responseText = await salixCall.text();
const response = JSON.parse(responseText); const response = JSON.parse(responseText);
if (salixCall.status !== 200) {
throw new Error(response.error.message);
}
const newVersion = salixCall.headers.get(SALIX_VERSION_HEADER); const newVersion = salixCall.headers.get(SALIX_VERSION_HEADER);
if (!this.salixVersion) { if (!this.salixVersion) {
@ -172,14 +173,13 @@ module.exports = class Salix {
async getSalixVersion() { async getSalixVersion() {
this.log("CHECK VERSION"); this.log("CHECK VERSION");
await this.fetch(this.conf.salix.api.status); await this.fetch(this.conf.salix.api.modelinfo);
this.log("VERSION CHECKED"); this.log("VERSION CHECKED -- "+ this.salixVersion);
} }
async salixLogInfo() { async salixLogInfo() {
this.log("REQUEST LOGINFO"); this.log("REQUEST LOGINFO");
await this.getToken();
let salixLogConfig = await this.fetch(this.conf.salix.api.logInfo); let salixLogConfig = await this.fetch(this.conf.salix.api.logInfo);
this._logInfo = salixLogConfig; this._logInfo = salixLogConfig;