#.env variable cannot access
24 messages · Page 1 of 1 (latest)
Show .env then
your env file is not in the backend folder where you're running it from
it wasn't on the first run, but it appears to be now (both from the file structure on the left and seeing that they didn't get a file load error the second time around)
i agree that seeing the file will be important 🙂
I think the problem is the location of his binary if he's using build and if he's run need to change the path to the .env file
../../internal/.env try this I think
no, it is not under the internal directory
it is under the backend directory
the spacing can make it a little hard to tell, but vs code only collapses to internal/server if server is the only thing within internal
(and the location of the binary is irrelevant to the working directory, which is where the file is loaded relative to)
why are so many people using .env /godotenv ? is that all copy pasted from some tutorial somewhere?
No thats first result in google
I mean using dotenv ... env vars should be set outside not inside a process
Didn't understand well what you're trying to say but the godotenv.load(path) depends on the location from where the program is executed
At least that's what I know
yes, correct
that is not the binary location
see the directory in the screenshot
the file is being loaded correctly, that is not the issue
super convenient, it works just as fine for setting the variables from outside like in a docker container, but for development you just set up the .env file & it works perfectly fine without any further configuration needed & so on.
yeah I suppose though sometimes because something is convenient isn't sufficient justification
The first not. The second yes I think maybe the problem is the PORT in the .env file maybe the name is not correct