fix: settings

This commit is contained in:
Isaac 2023-02-02 16:11:10 +00:00
parent 5a2106caa4
commit 12c741b255
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
5 changed files with 43 additions and 21 deletions

1
.npmrc Normal file
View File

@ -0,0 +1 @@
auto-install-peers=true

View File

@ -1,6 +1,6 @@
{ {
"name": "discord-tickets", "name": "discord-tickets",
"version": "4.0.0-beta.1", "version": "4.0.0-beta.2",
"private": "true", "private": "true",
"description": "An open-source Discord bot for ticket management", "description": "An open-source Discord bot for ticket management",
"main": "src/", "main": "src/",
@ -34,7 +34,7 @@
"node": ">=18.0" "node": ">=18.0"
}, },
"dependencies": { "dependencies": {
"@discord-tickets/settings": "^1.1.7", "@discord-tickets/settings": "^1.3.0",
"@eartharoid/dbf": "^0.3.3", "@eartharoid/dbf": "^0.3.3",
"@eartharoid/dtf": "^2.0.1", "@eartharoid/dtf": "^2.0.1",
"@eartharoid/i18n": "^1.2.1", "@eartharoid/i18n": "^1.2.1",
@ -75,6 +75,6 @@
"bufferutil": "^4.0.7", "bufferutil": "^4.0.7",
"erlpack": "github:discord/erlpack", "erlpack": "github:discord/erlpack",
"utf-8-validate": "^5.0.10", "utf-8-validate": "^5.0.10",
"zlib-sync": "^0.1.7" "zlib-sync": "^0.1.8"
} }
} }

View File

@ -1,7 +1,7 @@
lockfileVersion: 5.4 lockfileVersion: 5.4
specifiers: specifiers:
'@discord-tickets/settings': ^1.1.7 '@discord-tickets/settings': ^1.3.0
'@eartharoid/dbf': ^0.3.3 '@eartharoid/dbf': ^0.3.3
'@eartharoid/dtf': ^2.0.1 '@eartharoid/dtf': ^2.0.1
'@eartharoid/i18n': ^1.2.1 '@eartharoid/i18n': ^1.2.1
@ -38,10 +38,10 @@ specifiers:
terminal-link: ^2.1.1 terminal-link: ^2.1.1
utf-8-validate: ^5.0.10 utf-8-validate: ^5.0.10
yaml: ^1.10.2 yaml: ^1.10.2
zlib-sync: ^0.1.7 zlib-sync: ^0.1.8
dependencies: dependencies:
'@discord-tickets/settings': 1.1.7 '@discord-tickets/settings': 1.3.0_svelte@3.55.1
'@eartharoid/dbf': 0.3.3_3cxu5zja4e2r5wmvge7mdcljwq '@eartharoid/dbf': 0.3.3_3cxu5zja4e2r5wmvge7mdcljwq
'@eartharoid/dtf': 2.0.1 '@eartharoid/dtf': 2.0.1
'@eartharoid/i18n': 1.2.1 '@eartharoid/i18n': 1.2.1
@ -76,7 +76,7 @@ optionalDependencies:
bufferutil: 4.0.7 bufferutil: 4.0.7
erlpack: github.com/discord/erlpack/cbe76be04c2210fc9cb6ff95910f0937c1011d04 erlpack: github.com/discord/erlpack/cbe76be04c2210fc9cb6ff95910f0937c1011d04
utf-8-validate: 5.0.10 utf-8-validate: 5.0.10
zlib-sync: 0.1.7 zlib-sync: 0.1.8
devDependencies: devDependencies:
all-contributors-cli: 6.24.0 all-contributors-cli: 6.24.0
@ -93,8 +93,8 @@ packages:
regenerator-runtime: 0.13.11 regenerator-runtime: 0.13.11
dev: true dev: true
/@discord-tickets/settings/1.1.7: /@discord-tickets/settings/1.3.0_svelte@3.55.1:
resolution: {integrity: sha512-Y10SHQafNUkIhfM3hf6MNgEWm7z/rAGkbfhAuuBkpcITAm9mt6Kf9jm3RH1FZibPeDH8Mvd5U1208xLejTxDHA==} resolution: {integrity: sha512-fp7JSKY1SdhoE3WuE1lEVG4+QjFe9iAh8rKZJ1+9qwMOhr5/5zqCNhNy/BDgQ7RYn1R2/8nhJJiBYIeJNQG4RA==}
dependencies: dependencies:
'@fortawesome/fontawesome-free': 6.2.1 '@fortawesome/fontawesome-free': 6.2.1
cookie: 0.5.0 cookie: 0.5.0
@ -103,7 +103,9 @@ packages:
ms: 2.1.3 ms: 2.1.3
postcss: 8.4.21 postcss: 8.4.21
sortablejs: 1.15.0 sortablejs: 1.15.0
svelte-modals: 1.2.0-beta.0 svelte-modals: 1.2.1_svelte@3.55.1
transitivePeerDependencies:
- svelte
dev: false dev: false
/@discordjs/builders/1.4.0: /@discordjs/builders/1.4.0:
@ -185,7 +187,7 @@ packages:
resolution: {integrity: sha512-ebbEtlI7dxXF5ziNdr05mOY8NnDiPB1XvAlLHctRt/Rc+C3LCOVW5imUVX+mhvUhnNzmPBHewUkOFgGlCxgdAA==} resolution: {integrity: sha512-ebbEtlI7dxXF5ziNdr05mOY8NnDiPB1XvAlLHctRt/Rc+C3LCOVW5imUVX+mhvUhnNzmPBHewUkOFgGlCxgdAA==}
dependencies: dependencies:
ajv: 8.12.0 ajv: 8.12.0
ajv-formats: 2.1.1 ajv-formats: 2.1.1_ajv@8.12.0
fast-uri: 2.2.0 fast-uri: 2.2.0
dev: false dev: false
@ -220,7 +222,7 @@ packages:
/@fastify/http-proxy/8.4.0_3cxu5zja4e2r5wmvge7mdcljwq: /@fastify/http-proxy/8.4.0_3cxu5zja4e2r5wmvge7mdcljwq:
resolution: {integrity: sha512-H8nwsmawFtKKRE6uhh1BtF1gQi/l147SmLsDGxB0HdYTHzjXz6uSQO3lEVmY7unKMzbArRjdoJQkEGpScszdSw==} resolution: {integrity: sha512-H8nwsmawFtKKRE6uhh1BtF1gQi/l147SmLsDGxB0HdYTHzjXz6uSQO3lEVmY7unKMzbArRjdoJQkEGpScszdSw==}
dependencies: dependencies:
'@fastify/reply-from': 8.4.0 '@fastify/reply-from': 8.4.1
ws: 8.12.0_3cxu5zja4e2r5wmvge7mdcljwq ws: 8.12.0_3cxu5zja4e2r5wmvge7mdcljwq
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
@ -247,8 +249,8 @@ packages:
- supports-color - supports-color
dev: false dev: false
/@fastify/reply-from/8.4.0: /@fastify/reply-from/8.4.1:
resolution: {integrity: sha512-ju8h7k1aP3qHWwYOVZK+1jJJA6HnxXOHassU4mSRJ02ekDrCYD1t2gjCZWVHBRwJsAnMKnqfqWIzlSc+nRqyzA==} resolution: {integrity: sha512-fGI4aRAUs7Mo/X8Fx4IAYBVnNBCqrz65syhwxnyXjBF8Yalxdnom4CQRnGERUx8Kh7GW4W+FGnjrdbqX0+fiVg==}
dependencies: dependencies:
'@fastify/error': 3.2.0 '@fastify/error': 3.2.0
end-of-stream: 1.4.4 end-of-stream: 1.4.4
@ -462,8 +464,10 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/ajv-formats/2.1.1: /ajv-formats/2.1.1_ajv@8.12.0:
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependencies:
ajv: ^8.0.0
peerDependenciesMeta: peerDependenciesMeta:
ajv: ajv:
optional: true optional: true
@ -1146,7 +1150,7 @@ packages:
dependencies: dependencies:
'@fastify/deepmerge': 1.3.0 '@fastify/deepmerge': 1.3.0
ajv: 8.12.0 ajv: 8.12.0
ajv-formats: 2.1.1 ajv-formats: 2.1.1_ajv@8.12.0
fast-deep-equal: 3.1.3 fast-deep-equal: 3.1.3
fast-uri: 2.2.0 fast-uri: 2.2.0
rfdc: 1.3.0 rfdc: 1.3.0
@ -2428,8 +2432,17 @@ packages:
supports-color: 7.2.0 supports-color: 7.2.0
dev: false dev: false
/svelte-modals/1.2.0-beta.0: /svelte-modals/1.2.1_svelte@3.55.1:
resolution: {integrity: sha512-c6bHI9iGryCTUixJ8hHeG6mlus5AJUEBiB2B+iRTergQE429S1vME55XBdc8HU71X8e9xWOcjWAKm3X1oLpg8Q==} resolution: {integrity: sha512-7MEKUx5wb5YppkXWFGeRlYM5FMGEnpix39u9Y6GtCNTMXRDZ7DB2Z50IYLMRTMW5lOsCdtJgFbB0E3iZMKmsAA==}
peerDependencies:
svelte: ^3.0.0
dependencies:
svelte: 3.55.1
dev: false
/svelte/3.55.1:
resolution: {integrity: sha512-S+87/P0Ve67HxKkEV23iCdAh/SX1xiSfjF1HOglno/YTbSTW7RniICMCofWGdJJbdjw3S+0PfFb1JtGfTXE0oQ==}
engines: {node: '>= 8'}
dev: false dev: false
/terminal-link/2.1.1: /terminal-link/2.1.1:
@ -2691,8 +2704,8 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/zlib-sync/0.1.7: /zlib-sync/0.1.8:
resolution: {integrity: sha512-UmciU6ZrIwtwPC8noMzq+kGMdiWwNRZ3wC0SbED4Ew5Ikqx14MqDPRs/Pbk+3rZPh5SzsOgUBs1WRE0iieddpg==} resolution: {integrity: sha512-Xbu4odT5SbLsa1HFz8X/FvMgUbJYWxJYKB2+bqxJ6UOIIPaVGrqHEB3vyXDltSA6tTqBhSGYLgiVpzPQHYi3lA==}
requiresBuild: true requiresBuild: true
dependencies: dependencies:
nan: 2.17.0 nan: 2.17.0

View File

@ -13,11 +13,13 @@ const env = {
DISCORD_SECRET: '', DISCORD_SECRET: '',
DISCORD_TOKEN: '', DISCORD_TOKEN: '',
ENCRYPTION_KEY: randomBytes(24).toString('hex'), ENCRYPTION_KEY: randomBytes(24).toString('hex'),
// HOST_HEADER: 'x-forwarded-host',
HTTP_EXTERNAL: 'http://127.0.0.1:8080', HTTP_EXTERNAL: 'http://127.0.0.1:8080',
HTTP_HOST: '127.0.0.1', HTTP_HOST: '127.0.0.1',
HTTP_PORT: 8080, HTTP_PORT: 8080,
HTTP_TRUST_PROXY: false, HTTP_TRUST_PROXY: false,
OVERRIDE_ARCHIVE: '', OVERRIDE_ARCHIVE: '',
// PROTOCOL_HEADER: 'x-forwarded-proto',
PUBLIC_BOT: false, PUBLIC_BOT: false,
SETTINGS_HOST: '127.0.0.1', SETTINGS_HOST: '127.0.0.1',
SETTINGS_PORT: 8169, SETTINGS_PORT: 8169,

View File

@ -166,13 +166,19 @@ module.exports = async client => {
// express server for settings // express server for settings
const express = require('express')(); const express = require('express')();
const { handler } = await import('@discord-tickets/settings/build/handler.js'); const { handler } = await import('@discord-tickets/settings/build/handler.js');
process.on('sveltekit:error', ({
error,
errorId,
}) => {
client.log.error.http(`Express ${errorId} ${error}`);
});
express.set('trust proxy', true); express.set('trust proxy', true);
express.use((req, res, next) => { express.use((req, res, next) => {
next(); next();
client.log.verbose.http(short(`Express ${req.ip} ${req.method} ${req.route?.path ?? req.path}`)); client.log.verbose.http(short(`Express ${req.ip} ${req.method} ${req.route?.path ?? req.path}`));
}); });
express.use(handler); // let SvelteKit handle everything express.use(handler); // let SvelteKit handle everything
express.listen(process.env.SETTINGS_PORT, process.env.SETTINGS_HOST, () => { // start the express server express.listen(process.env.SETTINGS_PORT, process.env.SETTINGS_HOST, () => { // start the express server
client.log.verbose.http(`Express listening on port ${process.env.SETTINGS_PORT}`); client.log.verbose.http(`Express listening on port ${process.env.SETTINGS_PORT}`);
}); });