Skip to content
This repository was archived by the owner on Apr 6, 2024. It is now read-only.

Commit 4c0c45d

Browse files
committed
Add env back to fix docker
1 parent 6e2c6af commit 4c0c45d

File tree

6 files changed

+45
-5
lines changed

6 files changed

+45
-5
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/node_modules/
2+
**/dist
3+
.git
4+
npm-debug.log
5+
.coverage
6+
.coverage.*
7+
.aws

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ RUN npm install
77
COPY . /main/bot
88
LABEL name="cylane" version="1.5"
99
# Start the bot.
10-
CMD ["node", "./src/index.js"]
10+
CMD ["npm", "run", "start"]

application.example.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bot:
1818

1919
ENABLE_MESSAGE: false
2020
AUTO_DEPLOY: true
21+
PREFIX: "d!"
2122

2223
lavalink:
2324
# Your spotify id and secret, you can get it from here: https://developer.spotify.com/
@@ -27,6 +28,9 @@ lavalink:
2728
SPOTIFY_SECRET: Your spotify secret
2829

2930
DEFAULT: ["yorushika", "yoasobi", "tuyu", "hinkik"]
31+
32+
# Enable this if you want to use lavalink info from .env files
33+
ENV_NODE: false
3034

3135
# You can add more lavalink server!
3236
NODES: [

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ services:
4141
depends_on:
4242
- lavalink
4343
- mongodb
44+
environment:
45+
- TOKEN=${TOKEN}
46+
# Database
47+
- MONGO_URI=mongodb://cylane:cylake@mongodb:27017/streamhatchet?directConnection=true&authSource=admin&replicaSet=replicaset&retryWrites=true
48+
# Lavalink
49+
- NODE_URL=lavalink:2333
50+
- NODE_NAME=Dreamvast_DOCKER
51+
- NODE_AUTH=dreamvast
4452

4553
networks:
4654
lavalink-net:

src/client/sharding/manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Manager extends Client {
3535
this.config = require("../../plugins/config.js");
3636

3737
if (this.config.WEBSOCKET){
38-
logger.error("You cannot enable websocket on advanced shard system! To use ws, please run the bot in normal mode by type `npm run start:normal` or `npm start`")
38+
logger.error("You cannot enable websocket on advanced shard system! To use ws, please run the bot in normal mode by type `npm run start:normal` or `npm start`\n To disable, use WEBSOCKET: false in application.yml files")
3939
process.exit()
4040
}
4141

src/plugins/config.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ try {
1414

1515
module.exports = {
1616
// Bot config
17-
TOKEN: doc.bot.TOKEN || "YOUR_TOKEN", // your bot token
17+
TOKEN: process.env.TOKEN || doc.bot.TOKEN || "YOUR_TOKEN", // your bot token
1818
EMBED_COLOR: doc.bot.EMBED_COLOR || "#c2e9ff", //<= default is "#c2e9ff"
1919
OWNER_ID: doc.bot.OWNER_ID || "YOUR_CLIENT_ID", //your owner discord id example: "515490955801919488"
2020
NP_REALTIME: doc.bot.NP_REALTIME || "BOOLEAN", // "true" = realtime, "false" = not realtime :3 // WARNING: on set to "true" = laggy and bot will ratelimit if you have a lot of servers
@@ -24,7 +24,7 @@ module.exports = {
2424
directory: resolve("./src/languages"), // <= location of language
2525
},
2626
DEV_ID: doc.bot.DEV_ID || [], // if you want to use command bot only, you can put your id here example: ["123456789", "123456789"]
27-
MONGO_URI: doc.bot.MONGO_URI || "YOUR_MONGO_URI", // your mongo uri
27+
MONGO_URI: process.env.MONGO_URI || doc.bot.MONGO_URI || "YOUR_MONGO_URI", // your mongo uri
2828
ENABLE_MESSAGE: doc.bot.ENABLE_MESSAGE || false,
2929
AUTO_DEPLOY: doc.bot.AUTO_DEPLOY || true,
3030
PREFIX: doc.bot.PREFIX || "d!",
@@ -33,7 +33,15 @@ module.exports = {
3333
SPOTIFY_ID: doc.lavalink.SPOTIFY_ID,
3434
SPOTIFY_SECRET: doc.lavalink.SPOTIFY_SECRET,
3535
DEFAULT: doc.lavalink.DEFAULT || ["yorushika", "yoasobi", "tuyu", "hinkik"],
36-
NODES: doc.lavalink.NODES || [
36+
NODES: doc.lavalink.ENV_NODE ?
37+
[
38+
{
39+
url: process.env.NODE_URL || 'lavalink-coders.ml:80',
40+
name: process.env.NODE_NAME || 'Main (PROCESS.ENV)',
41+
auth: process.env.NODE_AUTH || 'coders',
42+
secure: parseBoolean(process.env.NODE_SECURE || 'false'),
43+
},
44+
] : doc.lavalink.NODES || [
3745
{
3846
url: 'lavalink-coders.ml:80',
3947
name: 'Main',
@@ -64,4 +72,17 @@ module.exports = {
6472
WEBSOCKET:doc.websocket.WEBSOCKET || false,
6573
AUTHENICATOR: doc.websocket.AUTHENICATOR || false,
6674
TRUSTED_ORIGIN: doc.websocket.TRUSTED_ORIGIN || ['http://localhost:3000']
75+
}
76+
77+
function parseBoolean(value){
78+
if (typeof(value) === 'string'){
79+
value = value.trim().toLowerCase();
80+
}
81+
switch(value){
82+
case true:
83+
case "true":
84+
return true;
85+
default:
86+
return false;
87+
}
6788
}

0 commit comments

Comments
 (0)