Questions tagged [dotenv]

This tag is for questions about the Dotenv Node.js module. For PHP, see the `phpdotenv` tag; for ruby, see the `ruby-dotenv` tag.

Dotenv is a zero-dependency Node.js module that loads environment variables from a .env file into process.env. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology.

Find NPM package here for documentaion.

Other language implementations

821 questions
-1
votes
2 answers

Adding Python library to Flask app requirements.txt

Long time Java dev who inherited a Python (Flask) application that is in dire need of some maintenance. Instead of using env vars or system properties or any kind of configuration (!!!) all the connections and credentials are hardcoded right there…
hotmeatballsoup
  • 385
  • 6
  • 58
  • 136
-1
votes
1 answer

How to 'evaluate' process.env values which are referenced in string values returned from a database request?

If I have HTML code within a document in a MongoDB database collection, which includes ${process.env.MY_VARIABLE}: { "page_name": "home_page", "page_content": "
Here is an environment variable: …
user1063287
  • 10,265
  • 25
  • 122
  • 218
-1
votes
1 answer

pytest fail on github action. TypeError: expected str, bytes or os.PathLike object, not NoneType

When I run pytest locally, it works well. But it fails on GitHub Actions. I set a secret key on GitHub secrets and uploaded .env.test to the GitHub repository both. Is it a dotenv package problem or something else? workflow.yml name: Django CI on:…
simon Shim
  • 13
  • 5
-1
votes
1 answer

Using Environment Variables to initialise MySQL connection in NextJS leads to 'ER_NOT_SUPPORTED_AUTH_MODE' error

I am trying to fetch data from a MySQL table. It works perfectly when I hardcode the configuration. But when I use env variables to configure it, I get the following error: code: 'ER_NOT_SUPPORTED_AUTH_MODE', errno: 1251, sqlMessage: 'Client…
-1
votes
1 answer

Why does express app not recognize dotenv file

I installed dotenv, created a .env file and wrote PORT = 5000 into it, but for some reason it says that the value in it is undefiend. What is the problem? File location: └── src ├── index.js └── .env require('dotenv').config(); const…
-1
votes
2 answers

Why don't I get any value from process.env?

I want to use environmental variables in my angular project to hide sensitive information. I have followed this tutorial using dotenv https://javascript.plainenglish.io/setup-dotenv-to-access-environment-variables-in-angular-9-f06c6ffb86c0 but I…
Jonon
  • 109
  • 1
  • 1
  • 10
-1
votes
1 answer

How to access environment variables client-side (Node.js)

I have declared some environment variables on my server using dotenv, and I want to be able to access one of them on my client-side code I have my .env file set up like so: NODE_ENV='development' DEF_USER='admin' then I have my config.js file where…
-1
votes
1 answer

reading .env with nextjs

I am trying to read .env in next.js inside the next.config.js this is how it looks require("dotenv").config({ path: require("find-config")(".env") }) console.log(process.env.API_URL) module.exports = { reactStrictMode: true, sassOptions: { …
Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
-1
votes
1 answer

How to access .env variable based on the mode

Let's say I have 2 files which are .env.development and .env.production. In my package.json, since the mode is development, it should access .env.development for the variables. "scripts": { "start": "webpack-dev-server --config…
CCCC
  • 5,665
  • 4
  • 41
  • 88
-1
votes
1 answer

DotEnv error while contectin to data base

The problem is simple, but i dont know if the think i am doing is wrong, i will try to explain it and if some knows how to solve it wold be cool and i will thank you so much. remember that this app is made whit NextJS DotEnv variables are in a…
-1
votes
1 answer

.env webpack pass value of environment variable but the app doesn't work

.env file in the project root: ESRI_KEY=api_key_value For the webpack config I have: const webpack = require('webpack'); const Dotenv = require('dotenv-webpack'); module.exports = { //----// plugins: [ new Dotenv(), ], }; and the…
mialee
  • 11
  • 1
-1
votes
1 answer

how to use Dotenv with react-scripts and without Webpack

I am exploring this React project from the repo below and the process.env is not returning any values (undefined when I console logged them). The variables are declared in a .env.local file created at the root as per the repo's instructions and all…
-1
votes
1 answer

dotenv celery docker container not updating immediately after change in .env file

I'm using dotenv within a docker celery container. The container has the code below. In between runs I change the content of .env1 from LOGGING_CONF_FILE=logging1.yaml to LOGGING_CONF_FILE=logging2.yaml I then touch the file __init__.py which…
Avner Moshkovitz
  • 1,138
  • 1
  • 18
  • 35
-1
votes
1 answer

Symfony 5.1.8 ignoring overrides from .env.test / .env.test.local

I have a Symfony 5.1.8 project, in which I want to use a different database connection for testing. To do so, I set up the file .env.test.local with a different value for DATABASE_URL than in my .env.local, just like the documentation in the .env…
dende
  • 119
  • 2
  • 8
-1
votes
2 answers

dotenv environment variables problem with typescript

My project structure look like this: |-project |-src |-index.ts |-.env in index.ts I'm trying to load environment variables: import dotenv from 'dotenv'; dotenv.config(); I've also tried with dotenv.config({ path:…
woda
  • 107
  • 1
  • 5
1 2 3
54
55