Merge pull request #1040 from JoaoCostaIFG/feature/select-dotenv-path

Feat: allow users to change dotenv file with env var
This commit is contained in:
Stefano 2024-10-29 09:15:43 +01:00 committed by GitHub
commit f1b4c74c09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View file

@ -52,5 +52,6 @@ ENV DATA_DIR=/data
ENV NODE_ENV=production
ENV COMMIT_HASH=$COMMIT_HASH
ENV BUILD_DATE=$BUILD_DATE
ENV ENV_FILE=/config
CMD ["tini", "--", "node", "--enable-source-maps", "dist/scripts/migrate-and-start.js"]

View file

@ -63,6 +63,8 @@ docker run -it -v "$(pwd)/data":/data -e DISCORD_TOKEN='' -e SPOTIFY_CLIENT_ID='
This starts Muse and creates a data directory in your current directory.
You can also store your tokens in an environment file and make it available to your container. By default, the container will look for a `/config` environment file. You can customize this path with the `ENV_FILE` environment variable to use with, for example, [docker secrets](https://docs.docker.com/engine/swarm/secrets/).
**Docker Compose**:
```yaml

View file

@ -5,7 +5,7 @@ import path from 'path';
import xbytes from 'xbytes';
import {ConditionalKeys} from 'type-fest';
import {ActivityType, PresenceStatusData} from 'discord.js';
dotenv.config();
dotenv.config({path: process.env.ENV_FILE ?? path.resolve(process.cwd(), '.env')});
export const DATA_DIR = path.resolve(process.env.DATA_DIR ? process.env.DATA_DIR : './data');