kerimdzhanov / dotenv-flow

Loads environment variables from .env.[development|test|production][.local] files for Node.js® projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to disable logs about already defined env

vimutti77 opened this issue · comments

When I run my production app with docker docker run -e foo=1 -e bar=2 myapp always get the logs about already defined env like this

dotenv-flow: "foo" is already defined in `process.env` and will not be overwritten
dotenv-flow: "bar" is already defined in `process.env` and will not be overwritten

How can I disable these log.

Nice remark, it seems that we need to add the silent option.

@kerimdzhanov Any planning update this in near future?

@anandchapter247, the silent option is already implemented in v3.1.0. You just need to update.

How is that supposed to be used ES modules?

Seems like this:

import { config } from "dotenv-flow";
config({ silent: true });

Hi @metaskills,

Yup, that should work starting from dotenv-flow v3.3.0.

Alternatively, this also works:

import dotenvFlow from 'dotenv-flow';
dotenvFlow.config({ silent: true });

Or upgrade to dotenv-flow v4 where this message is moved to debug logs which are disabled by default and can be enabled via { debug: true }.