From 10eef102165f30e98a759b145bf3e88b4d2c0095 Mon Sep 17 00:00:00 2001 From: Isaac Date: Sat, 20 Jan 2024 20:50:35 +0000 Subject: [PATCH] feat: add `HTTP_INTERNAL` env variable --- scripts/preinstall.js | 3 ++- src/http.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/preinstall.js b/scripts/preinstall.js index c30c1f4b6..4bd64807e 100644 --- a/scripts/preinstall.js +++ b/scripts/preinstall.js @@ -20,6 +20,7 @@ const env = { ENCRYPTION_KEY: randomBytes(24).toString('hex'), HTTP_EXTERNAL: 'http://127.0.0.1:8169', HTTP_HOST: '0.0.0.0', + HTTP_INTERNAL: '', HTTP_PORT: 8169, HTTP_TRUST_PROXY: false, NODE_ENV: 'production', // not bot-specific @@ -37,4 +38,4 @@ if (!process.env.ENCRYPTION_KEY && !fs.existsSync('./.env')) { log(short('&r&0&!e WARNING &r &e&lkeep your environment variables safe, don\'t lose your encryption key or you will lose data')); } else { log('nothing to do'); -} \ No newline at end of file +} diff --git a/src/http.js b/src/http.js index af0911a0b..82cb214bf 100644 --- a/src/http.js +++ b/src/http.js @@ -6,7 +6,7 @@ const { join } = require('path'); const { files } = require('node-dir'); const { PermissionsBitField } = require('discord.js'); -process.env.ORIGIN = process.env.HTTP_EXTERNAL; +process.env.ORIGIN = process.env.HTTP_INTERNAL || process.env.HTTP_EXTERNAL; module.exports = async client => { // oauth2 plugin