mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 09:12:43 +02:00
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:
commit
f1b4c74c09
3 changed files with 4 additions and 1 deletions
|
@ -52,5 +52,6 @@ ENV DATA_DIR=/data
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV COMMIT_HASH=$COMMIT_HASH
|
ENV COMMIT_HASH=$COMMIT_HASH
|
||||||
ENV BUILD_DATE=$BUILD_DATE
|
ENV BUILD_DATE=$BUILD_DATE
|
||||||
|
ENV ENV_FILE=/config
|
||||||
|
|
||||||
CMD ["tini", "--", "node", "--enable-source-maps", "dist/scripts/migrate-and-start.js"]
|
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.
|
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**:
|
**Docker Compose**:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
|
@ -5,7 +5,7 @@ import path from 'path';
|
||||||
import xbytes from 'xbytes';
|
import xbytes from 'xbytes';
|
||||||
import {ConditionalKeys} from 'type-fest';
|
import {ConditionalKeys} from 'type-fest';
|
||||||
import {ActivityType, PresenceStatusData} from 'discord.js';
|
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');
|
export const DATA_DIR = path.resolve(process.env.DATA_DIR ? process.env.DATA_DIR : './data');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue