Questions tagged [env-file]

32 questions
106
votes
11 answers

How to load environment variables from .env file using Vite

I want to load environment variables from the .env file using Vite I used the import.meta.env object as mentioned in Docs .env file: TEST_VAR=123F when trying to access this variable via the import.meta.env -> import.meta.env.TEST_VAR it returns…
Mohamed Fadl
  • 1,303
  • 2
  • 8
  • 10
9
votes
2 answers

Override variables in docker-compose env_file with the actual environment from the outside

Given a very simple docker-compose file: version: '3' services: test: image: busybox env_file: - my.env command: env And the my.env file referenced in there: FOO=BAR Running docker-compose up prints as expected (container name…
Dirk
  • 9,381
  • 17
  • 70
  • 98
6
votes
1 answer

How to comment multiple lines in env file

I wanted to know if there is any way to comment a block or multiple lines in .env file. I know that by using # we can comment a single line but I want to comment multiple lines at once. Currently I am using visual studio code in ubuntu and working…
Yogi Katba
  • 189
  • 1
  • 2
  • 6
3
votes
2 answers

Getting "docker: open .env: permission denied." when trying to pass a .env file to docker run

I have no problems running the test "Hello World" image. But when I try to pass the --env-file variable as part of my docker run command I am getting docker: open .env: permission denied. I have tried granting full permissions on my .env file but…
adam s
  • 31
  • 1
  • 2
2
votes
1 answer

Is there a way to pass arguments to our own docker container in sagemaker?

I am trying to train my model using Bring your own container technique in sagemaker. My model training runs correctly without any issues locally. But my docker image takes env-file as an input that could change at different runs. But in sagemaker…
2
votes
1 answer

create-react-app does not pick up .env file

I created .env file in the root of my directory with data REACT_APP_API_URL=http:\\localhost:3001, but when I run and get value from process.env, I get an empty object, how can I fix that?
1
vote
0 answers

Unique .env file in monorepo

I am trying to get to an understanding of what the best approach is to handling environment variables in a monorepo. I am using turborepo and the project structure is organised into a /apps and /packages directories among others. The current state…
1
vote
1 answer

docker run --env-file /path/to/file.env fails with "no such file or directory"

I'm trying to run a docker image on a Debian server. The preproduced image has been pulled from Docker Hub. The cmd line is (stripped to the bones): sudo docker run -d -p 8190:433 --env-file /path/to/file.env my-image /path/to/file.env is similiar…
Recurs1on
  • 39
  • 1
  • 5
1
vote
1 answer

.env file not gitignored. I had someone do it manually for me once

So im currently working on a project and my my .env file is not greyed out (gitignore?). Trying to figure out what I need to do globally because I do have the file but my .env is never greyed out. Any suggestions? I can provide screenshots if…
1
vote
0 answers

Is it more secure to delete .env file in the production server after running the service?

Current Situation: I have a server running a NestJS using .env file to handle environment variables (including secrets). I use GitHub Actions to do the whole CI flow, storing the secret values in the GitHub Actions Secrets. When pushing the commits,…
1
vote
3 answers

How to make docker-compose ".env" file take precedence over shell env vars?

I would like my docker-compose.yml file to use the ".env" file in the same directory as the "docker-compose.yml" file to set some envrionment variables and for those to take precedence for any other env vars set in the shell. Right now I have $…
Dave
  • 15,639
  • 133
  • 442
  • 830
1
vote
1 answer

How to rename .env file in Laravel 8

In Laravel 8 the .env file is well protected out of the public folder. Additionally, I've added a rule in nginx to protect hidden files location ~ /\. { deny all; } However, I've seen several requests to the server looking for the .env file in the…
Acronym
  • 23
  • 4
1
vote
1 answer

Environment variables when deploying Firebase Cloud functions with Github Actions

I have been trying to automate the deployment of firebase cloud functions using the Github actions CI/CD workflows. The functions are developed using NodeJs, Express, and Typescript. And all environment variables are saved in a .env file that is not…
1
vote
0 answers

How to set key-value within .env file using python-decouple

I am experimenting with the python-decouple library using below code: if __name__ == '__main__': TEMPLATE_DEBUG = config('TEMPLATE_DEBUG') DATABASE_URL = config('DATABASE_URL') print(TEMPLATE_DEBUG,'\n',DATABASE_URL) …
1
vote
1 answer

Encoding of .env-files used by docker-compose

I have a docker-compose file which references an .env file like this: version: '2.4' services: MyService: #...more in here env_file: - staging.env Now in my staging.env I have occurrences of German umlauts. So I saved…
Hermann.Gruber
  • 1,257
  • 1
  • 12
  • 37
1
2 3