diff --git a/README.md b/README.md index 395a50e..8b14cc8 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,8 @@ export default { | fsTppVersion | undefined | _DEPRECATED: use [`FSXA_SNAP_URL`](https://github.com/e-Spirit/fsxa-pattern-library/#snap-url) instead_ You can provide a version for tpp-snap. Check [this](https://www.npmjs.com/package/fs-tpp-api) out for more details. | | enableEventStream | false | When enabled, events for `insert`, `replace` and `delete` CaaS documents can be observed and handled. It's currently used in preview mode, to sync updated data in FirstSpirit with the CaaS and the App State. | +The LogLevel can also be set by providing an env variable called `FSXA_LOG_LEVEL`. This will be priorized over the configuration file option. + ## Legal Notices FSXA-Nuxt-Module is a product of [Crownpeak Technology GmbH](http://www.e-spirit.com), Dortmund, Germany. diff --git a/src/module/index.ts b/src/module/index.ts index 3898e4f..09d5338 100644 --- a/src/module/index.ts +++ b/src/module/index.ts @@ -38,6 +38,9 @@ export interface FSXAModuleOptions { client?: string; }; } + +const LOG_LEVEL: string = process.env.FSXA_LOG_LEVEL; + const FSXAModule: Module = function (moduleOptions) { // try to access config file let fileConfiguration = {}; @@ -46,6 +49,10 @@ const FSXAModule: Module = function (moduleOptions) { if (configFilePath) { // eslint-disable-next-line fileConfiguration = require(configFilePath).default; + // ENV variable will take the priority + if (LOG_LEVEL && LOG_LEVEL in LogLevel) { + fileConfiguration["logLevel"] = LOG_LEVEL; + } // watch config file if (this.nuxt.options.dev) { this.nuxt.options.watch.push(configFilePath);