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

Commit

Permalink
Add env back to fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
RainyXeon committed Mar 11, 2023
1 parent 6e2c6af commit 4c0c45d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/node_modules/
**/dist
.git
npm-debug.log
.coverage
.coverage.*
.aws
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ RUN npm install
COPY . /main/bot
LABEL name="cylane" version="1.5"
# Start the bot.
CMD ["node", "./src/index.js"]
CMD ["npm", "run", "start"]
4 changes: 4 additions & 0 deletions application.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bot:

ENABLE_MESSAGE: false
AUTO_DEPLOY: true
PREFIX: "d!"

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

DEFAULT: ["yorushika", "yoasobi", "tuyu", "hinkik"]

# Enable this if you want to use lavalink info from .env files
ENV_NODE: false

# You can add more lavalink server!
NODES: [
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ services:
depends_on:
- lavalink
- mongodb
environment:
- TOKEN=${TOKEN}
# Database
- MONGO_URI=mongodb://cylane:cylake@mongodb:27017/streamhatchet?directConnection=true&authSource=admin&replicaSet=replicaset&retryWrites=true
# Lavalink
- NODE_URL=lavalink:2333
- NODE_NAME=Dreamvast_DOCKER
- NODE_AUTH=dreamvast

networks:
lavalink-net:
Expand Down
2 changes: 1 addition & 1 deletion src/client/sharding/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Manager extends Client {
this.config = require("../../plugins/config.js");

if (this.config.WEBSOCKET){
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`")
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")
process.exit()
}

Expand Down
27 changes: 24 additions & 3 deletions src/plugins/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ try {

module.exports = {
// Bot config
TOKEN: doc.bot.TOKEN || "YOUR_TOKEN", // your bot token
TOKEN: process.env.TOKEN || doc.bot.TOKEN || "YOUR_TOKEN", // your bot token
EMBED_COLOR: doc.bot.EMBED_COLOR || "#c2e9ff", //<= default is "#c2e9ff"
OWNER_ID: doc.bot.OWNER_ID || "YOUR_CLIENT_ID", //your owner discord id example: "515490955801919488"
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
Expand All @@ -24,7 +24,7 @@ module.exports = {
directory: resolve("./src/languages"), // <= location of language
},
DEV_ID: doc.bot.DEV_ID || [], // if you want to use command bot only, you can put your id here example: ["123456789", "123456789"]
MONGO_URI: doc.bot.MONGO_URI || "YOUR_MONGO_URI", // your mongo uri
MONGO_URI: process.env.MONGO_URI || doc.bot.MONGO_URI || "YOUR_MONGO_URI", // your mongo uri
ENABLE_MESSAGE: doc.bot.ENABLE_MESSAGE || false,
AUTO_DEPLOY: doc.bot.AUTO_DEPLOY || true,
PREFIX: doc.bot.PREFIX || "d!",
Expand All @@ -33,7 +33,15 @@ module.exports = {
SPOTIFY_ID: doc.lavalink.SPOTIFY_ID,
SPOTIFY_SECRET: doc.lavalink.SPOTIFY_SECRET,
DEFAULT: doc.lavalink.DEFAULT || ["yorushika", "yoasobi", "tuyu", "hinkik"],
NODES: doc.lavalink.NODES || [
NODES: doc.lavalink.ENV_NODE ?
[
{
url: process.env.NODE_URL || 'lavalink-coders.ml:80',
name: process.env.NODE_NAME || 'Main (PROCESS.ENV)',
auth: process.env.NODE_AUTH || 'coders',
secure: parseBoolean(process.env.NODE_SECURE || 'false'),
},
] : doc.lavalink.NODES || [
{
url: 'lavalink-coders.ml:80',
name: 'Main',
Expand Down Expand Up @@ -64,4 +72,17 @@ module.exports = {
WEBSOCKET:doc.websocket.WEBSOCKET || false,
AUTHENICATOR: doc.websocket.AUTHENICATOR || false,
TRUSTED_ORIGIN: doc.websocket.TRUSTED_ORIGIN || ['http://localhost:3000']
}

function parseBoolean(value){
if (typeof(value) === 'string'){
value = value.trim().toLowerCase();
}
switch(value){
case true:
case "true":
return true;
default:
return false;
}
}

0 comments on commit 4c0c45d

Please sign in to comment.