pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.84k stars 1.75k forks source link

fix: added loading of .env file to entrypoint.sh #5242

Closed mlunkeit closed 2 weeks ago

mlunkeit commented 3 weeks ago

Fix: Load environment variables from /app/.env in entrypoint.sh

When using the Pterodactyl panel with Docker, environment variables such as DB_PORT and DB_HOST were not being loaded in entrypoint.sh. This commit resolves the issue by loading the /app/.env file using xargs, ensuring that all necessary environment variables are available at runtime.

WeeskyBDW commented 2 weeks ago

Correct me if i'm wrong but normally docker load .env file that is located at the same location of the compose (docker-compose.yml) file, so it shouldn't be necessary to add that. I already used pterodactyl with docker and i never had to make that, also because thoses variables you mentionned are specified in the docker-compose (see the example compose file located at project's root ligne 72 and 73).

If docker dont load the .env i would recommand to check if you have up-to-date versions of both docker and docker compose. Again if i'm wrong feel free to correct me.

mlunkeit commented 2 weeks ago

Thank you for your response, I created a volume in the docker-compose.yml and linked panel.env to /app/.env, I think this is a possible reason why the .env wasn't recognized by the entrypoint.sh file. But it also works with committed code. I guess I'm going to close my pull request since it was my bad naming the file panel.env and not .env on my host system.

WeeskyBDW commented 2 weeks ago

If it can help you, you can set env_file with the name of your dotfile (see docker-compose's env_file doc) and it's simplier than mounting the .env

edit: make the comment more "friendly" with better doc link and a less "rude" beginning

mlunkeit commented 2 weeks ago

Thank you, I didn't know that.