diff --git a/server/src/constants.ts b/server/src/constants.ts index 73c48c17..f664edbd 100644 --- a/server/src/constants.ts +++ b/server/src/constants.ts @@ -28,3 +28,5 @@ export const TTS_PROVIDER = process.env['LEON_TTS_PROVIDER'] export const HAS_OVER_HTTP = process.env['LEON_OVER_HTTP'] === 'true' export const HTTP_API_KEY = process.env['LEON_HTTP_API_KEY'] export const HTTP_API_LANG = process.env['LEON_HTTP_API_LANG'] + +export const HAS_LOGGER = process.env['LEON_LOGGER'] === 'true' diff --git a/server/src/core/http-server/api/info/get.js b/server/src/core/http-server/api/info/get.js index cf7d7faf..53ce1789 100644 --- a/server/src/core/http-server/api/info/get.js +++ b/server/src/core/http-server/api/info/get.js @@ -1,6 +1,7 @@ import { version } from '@@/package.json' import { HAS_AFTER_SPEECH, + HAS_LOGGER, HAS_STT, HAS_TTS, STT_PROVIDER, @@ -22,7 +23,7 @@ const getInfo = async (fastify, options) => { code: 'info_pulled', message, after_speech: HAS_AFTER_SPEECH, - logger: process.env.LEON_LOGGER === 'true', + logger: HAS_LOGGER, stt: { enabled: HAS_STT, provider: STT_PROVIDER diff --git a/server/src/core/http-server/server.js b/server/src/core/http-server/server.js index ad5c379a..cdd58242 100644 --- a/server/src/core/http-server/server.js +++ b/server/src/core/http-server/server.js @@ -6,6 +6,7 @@ import { join } from 'path' import { version } from '@@/package.json' import { endpoints } from '@@/core/skills-endpoints.json' import { + HAS_LOGGER, HAS_OVER_HTTP, HAS_STT, HAS_TTS, @@ -379,7 +380,7 @@ server.init = async () => { log.success(`The current time zone is ${date.timeZone()}`) - const sLogger = process.env.LEON_LOGGER !== 'true' ? 'disabled' : 'enabled' + const sLogger = !HAS_LOGGER ? 'disabled' : 'enabled' log.success(`Collaborative logger ${sLogger}`) await addProvider('1') diff --git a/server/src/core/nlu.js b/server/src/core/nlu.js index a6a9491e..8504c1c7 100644 --- a/server/src/core/nlu.js +++ b/server/src/core/nlu.js @@ -10,7 +10,7 @@ import kill from 'tree-kill' import { langs } from '@@/core/langs.json' import { version } from '@@/package.json' -import { IS_TESTING_ENV } from '@/constants' +import { HAS_LOGGER, IS_TESTING_ENV } from '@/constants' import Ner from '@/core/ner' import log from '@/helpers/log' import string from '@/helpers/string' @@ -243,7 +243,7 @@ class Nlu { */ sendLog(utterance) { /* istanbul ignore next */ - if (process.env.LEON_LOGGER === 'true' && !IS_TESTING_ENV) { + if (HAS_LOGGER && !IS_TESTING_ENV) { this.request .post('https://logger.getleon.ai/v1/expressions') .set('X-Origin', 'leon-core')