From 6e7fe75654ed5cfa18515de33390c6e5fe2ed0c8 Mon Sep 17 00:00:00 2001 From: Neshura Date: Wed, 3 Jan 2024 22:53:51 +0100 Subject: [PATCH] Use env vars instead of file contents (also allows for easier ci testing) --- src/routes/services/+page.server.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/routes/services/+page.server.ts b/src/routes/services/+page.server.ts index 24d397b..18c1b01 100644 --- a/src/routes/services/+page.server.ts +++ b/src/routes/services/+page.server.ts @@ -5,28 +5,14 @@ export async function load() { const credFile = './credentials.json'; const socket = io('https://status.neshweb.net/'); - let credentials = { - username: '', - password: '' - }; - if (fs.existsSync(credFile)) { - const buf = fs.readFileSync(credFile); - credentials = JSON.parse(buf.toString()); - } else { - console.error('Credentials File does not exist, Socket.io connection will not work.'); - } - - console.log(credentials); - let token = ''; socket.on('connect', () => { socket.emit( 'login', - { username: credentials.username, password: credentials.password, token: '' }, + { username: process.env.KUMA_USERNAME, password: process.env.KUMA_PASSWORD, token: '' }, (res) => { token = res.token; - console.log('Token is:', token); } ); });