#How to deal with env variables?

35 messages · Page 1 of 1 (latest)

glass spadeBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

patent wraith
#

use next/env

olive ginkgo
patent wraith
olive ginkgo
patent wraith
#

alternative methods are available

#

i didn't encounter the same problem but hope this will solve urs

olive ginkgo
#

Thank you, I will test it out, do you have to copy env file into docker image btw?

patent wraith
#

can u please tell me more specifically whats the problem is

#

why u need to copy it into docker image

#

for what ur using the docker

olive ginkgo
#

I'm trying to self host

patent wraith
#

ohh u have to put the environment in the next configuration file and from there u can access it like this process.env.name

#

like u don't need to make a .env file for that

#

like this 'module.exports = {
env: {
customKey: 'my-value',
},
}'

#

hope u get it

olive ginkgo
patent wraith
#

Yes, that's right. If you put environment variables in the Next.js config or .env files, and then build the Docker image, those variables will be part of the image. However, you can also pass them in at runtime when the container starts, which keeps them out of the image itself.

olive ginkgo
patent wraith
#

passing the env variables explicitly as arguments to rhe docker

#

command

olive ginkgo
patent wraith
#

not to dockerfile but to pass them to the docker when it starts

#

like in the above command

#

for what u are using the docker

#

??

olive ginkgo
#

Got you, why am I using Docker? Just trying to self host on AWS

patent wraith
#

so 2 ways to start the docker container either access them from the .env or access them directly at docker run time

olive ginkgo
#

Got it, thanks man

patent wraith
#

🥰

olive ginkgo
#

How to deal with env variables?

glass spadeBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer