From a30ca1eb688c90286f25b8187c8f7519c6010907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Sun, 14 Nov 2021 15:28:09 +0100 Subject: [PATCH] config: Change from dotenv to loading config.json --- .gitignore | 2 +- app.ts | 11 +++++------ package-lock.json | 14 -------------- package.json | 1 - 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 3e72f0c..8a51693 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules/ -.env +config.json app.js diff --git a/app.ts b/app.ts index 7aec761..817a89b 100644 --- a/app.ts +++ b/app.ts @@ -1,19 +1,18 @@ import { TeamSpeak, QueryProtocol } from "ts3-nodejs-library"; import { GraphQLClient, gql } from "graphql-request"; -import dotenv from "dotenv"; type Variables = { [key: string]: any }; -dotenv.config(); +var config = require("./config.json"); var voter = ""; const teamspeak = new TeamSpeak({ - host: process.env.HOST, + host: config.host, protocol: QueryProtocol.RAW, //optional queryport: 10011, //optional serverport: 9987, - username: process.env.USERNAME, - password: process.env.PASSWORD, + username: config.username, + password: config.password, nickname: "10Man", }); @@ -130,7 +129,7 @@ function get_error(e: unknown): string { } async function request(query: string, variables?: Variables): Promise { - const endpoint = process.env.ENDPOINT!; + const endpoint = config.endpoint!; const graphQLClient = new GraphQLClient(endpoint, { headers: {}, }); diff --git a/package-lock.json b/package-lock.json index 4174504..b39a9af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,6 @@ "name": "10man-ts3", "version": "1.0.0", "dependencies": { - "dotenv": "^10.0.0", "graphql": "^15.7.2", "graphql-request": "^3.6.1", "ts3-nodejs-library": "^3.4.0" @@ -92,14 +91,6 @@ "node": ">=0.4.0" } }, - "node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "engines": { - "node": ">=10" - } - }, "node_modules/extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", @@ -278,11 +269,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" - }, "extract-files": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/extract-files/-/extract-files-9.0.0.tgz", diff --git a/package.json b/package.json index 46264c3..e86cbd7 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "keywords": [], "author": "Thorben Günther", "dependencies": { - "dotenv": "^10.0.0", "graphql": "^15.7.2", "graphql-request": "^3.6.1", "ts3-nodejs-library": "^3.4.0" -- 2.44.0