From de0af4d2ac8c6b0e41250aa74f6cefedab93f1d3 Mon Sep 17 00:00:00 2001 From: jay Date: Thu, 24 Dec 2020 08:52:50 +0500 Subject: [PATCH] feat: :rocket: add and use `dotenv-packed` Use dotenv for more convenient credential management --- lib/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/index.js b/lib/index.js index 816eabb..945e18c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,4 +1,4 @@ -// TODO reload +const env = require("dotenv-packed").parseEnv().parsed const fs = require('fs'); let cfg = { admin: "Applezaus", @@ -12,14 +12,14 @@ const mineflayer = require("mineflayer"); const bot = !isNaN(parseInt(process.argv[3])) && parseInt(process.argv[3]) > 1e2 ? mineflayer.createBot({ - host: process.argv[2] || process.env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want. - port: parseInt(process.argv[3]) || process.env.MINECRAFT_PORT // || 58471, + host: process.argv[2] || process.env.MINECRAFT_HOST || env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want. + port: parseInt(process.argv[3]) || process.env.MINECRAFT_PORT || env.MINECRAFT_PORT // || 58471, }) : mineflayer.createBot({ - host: process.argv[2] || process.env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want. - username: process.argv[3] || process.env.MINECRAFT_USER, - password: process.argv[4] || process.env.MINECRAFT_PASS, + host: process.argv[2] || process.env.MINECRAFT_HOST || env.MINECRAFT_HOST || 'localhost', // Change this to the ip you want. + username: process.argv[3] || process.env.MINECRAFT_USER || env.MINECRAFT_USER, + password: process.argv[4] || process.env.MINECRAFT_PASS || env.MINECRAFT_PASS, // port: process.argv[5] || process.env.MINECRAFT_PORT || 58471, })