diff options
| author | Stefano <[email protected]> | 2024-10-29 09:15:43 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-29 09:15:43 +0100 |
| commit | f1b4c74c09a9c60f6cbf81ae6fa0ce2ebb27dcde (patch) | |
| tree | 6fd5e75aa7df5ac37f75654bab203c85df8a0736 | |
| parent | 534d8fafaa7f09f7ba940d044b08e6c48f800c7a (diff) | |
| parent | c954cccacbf9f4aaf911b9a232a8dec8117af932 (diff) | |
| download | muse-f1b4c74c09a9c60f6cbf81ae6fa0ce2ebb27dcde.tar.xz muse-f1b4c74c09a9c60f6cbf81ae6fa0ce2ebb27dcde.zip | |
Merge pull request #1040 from JoaoCostaIFG/feature/select-dotenv-path
Feat: allow users to change dotenv file with env var
| -rw-r--r-- | Dockerfile | 1 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | src/services/config.ts | 2 |
3 files changed, 4 insertions, 1 deletions
@@ -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"] @@ -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 diff --git a/src/services/config.ts b/src/services/config.ts index b6b9aea..019df07 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -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'); |
