diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 7f3925ad5..45d41ed46 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -6,7 +6,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE run: run } - require('dotenv').config() const open = require('open') let port = global.env.HTTP_INTERFACE_PORT diff --git a/Client/node_modules/dotenv/config.js b/Client/node_modules/dotenv/config.js deleted file mode 100644 index c7e6447fc..000000000 --- a/Client/node_modules/dotenv/config.js +++ /dev/null @@ -1,11 +0,0 @@ -/* @flow */ - -(function () { - require('./lib/main').config( - Object.assign( - {}, - require('./lib/env-options'), - require('./lib/cli-options')(process.argv) - ) - ) -})() diff --git a/Client/node_modules/dotenv/lib/cli-options.js b/Client/node_modules/dotenv/lib/cli-options.js deleted file mode 100644 index ad69fabd9..000000000 --- a/Client/node_modules/dotenv/lib/cli-options.js +++ /dev/null @@ -1,13 +0,0 @@ -/* @flow */ - -const re = /^dotenv_config_(encoding|path|debug)=(.+)$/ - -module.exports = function optionMatcher (args /*: Array */) { - return args.reduce(function (acc, cur) { - const matches = cur.match(re) - if (matches) { - acc[matches[1]] = matches[2] - } - return acc - }, {}) -} diff --git a/Client/node_modules/dotenv/lib/env-options.js b/Client/node_modules/dotenv/lib/env-options.js deleted file mode 100644 index b4c4a6068..000000000 --- a/Client/node_modules/dotenv/lib/env-options.js +++ /dev/null @@ -1,18 +0,0 @@ -/* @flow */ - -// ../config.js accepts options via environment variables -const options = {} - -if (process.env.DOTENV_CONFIG_ENCODING != null) { - options.encoding = process.env.DOTENV_CONFIG_ENCODING -} - -if (process.env.DOTENV_CONFIG_PATH != null) { - options.path = process.env.DOTENV_CONFIG_PATH -} - -if (process.env.DOTENV_CONFIG_DEBUG != null) { - options.debug = process.env.DOTENV_CONFIG_DEBUG -} - -module.exports = options diff --git a/Client/node_modules/dotenv/lib/main.js b/Client/node_modules/dotenv/lib/main.js deleted file mode 100644 index e6c591c6b..000000000 --- a/Client/node_modules/dotenv/lib/main.js +++ /dev/null @@ -1,113 +0,0 @@ -/* @flow */ -/*:: - -type DotenvParseOptions = { - debug?: boolean -} - -// keys and values from src -type DotenvParseOutput = { [string]: string } - -type DotenvConfigOptions = { - path?: string, // path to .env file - encoding?: string, // encoding of .env file - debug?: string // turn on logging for debugging purposes -} - -type DotenvConfigOutput = { - parsed?: DotenvParseOutput, - error?: Error -} - -*/ - -const fs = require('fs') -const path = require('path') - -function log (message /*: string */) { - console.log(`[dotenv][DEBUG] ${message}`) -} - -const NEWLINE = '\n' -const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/ -const RE_NEWLINES = /\\n/g -const NEWLINES_MATCH = /\n|\r|\r\n/ - -// Parses src into an Object -function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ { - const debug = Boolean(options && options.debug) - const obj = {} - - // convert Buffers before splitting into lines and processing - src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) { - // matching "KEY' and 'VAL' in 'KEY=VAL' - const keyValueArr = line.match(RE_INI_KEY_VAL) - // matched? - if (keyValueArr != null) { - const key = keyValueArr[1] - // default undefined or missing values to empty string - let val = (keyValueArr[2] || '') - const end = val.length - 1 - const isDoubleQuoted = val[0] === '"' && val[end] === '"' - const isSingleQuoted = val[0] === "'" && val[end] === "'" - - // if single or double quoted, remove quotes - if (isSingleQuoted || isDoubleQuoted) { - val = val.substring(1, end) - - // if double quoted, expand newlines - if (isDoubleQuoted) { - val = val.replace(RE_NEWLINES, NEWLINE) - } - } else { - // remove surrounding whitespace - val = val.trim() - } - - obj[key] = val - } else if (debug) { - log(`did not match key and value when parsing line ${idx + 1}: ${line}`) - } - }) - - return obj -} - -// Populates process.env from .env file -function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ { - let dotenvPath = path.resolve(process.cwd(), '.env') - let encoding /*: string */ = 'utf8' - let debug = false - - if (options) { - if (options.path != null) { - dotenvPath = options.path - } - if (options.encoding != null) { - encoding = options.encoding - } - if (options.debug != null) { - debug = true - } - } - - try { - // specifying an encoding returns a string instead of a buffer - const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug }) - - Object.keys(parsed).forEach(function (key) { - if (!Object.prototype.hasOwnProperty.call(process.env, key)) { - process.env[key] = parsed[key] - } else if (debug) { - log(`"${key}" is already defined in \`process.env\` and will not be overwritten`) - } - }) - - return { parsed } - } catch (e) { - return { error: e } - } -} - -module.exports.config = config -module.exports.parse = parse diff --git a/Client/node_modules/dotenv/package.json b/Client/node_modules/dotenv/package.json deleted file mode 100644 index a23bec94a..000000000 --- a/Client/node_modules/dotenv/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "_from": "dotenv@^8.2.0", - "_id": "dotenv@8.2.0", - "_inBundle": false, - "_integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", - "_location": "/dotenv", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "dotenv@^8.2.0", - "name": "dotenv", - "escapedName": "dotenv", - "rawSpec": "^8.2.0", - "saveSpec": null, - "fetchSpec": "^8.2.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "_shasum": "97e619259ada750eea3e4ea3e26bceea5424b16a", - "_spec": "dotenv@^8.2.0", - "_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers", - "bugs": { - "url": "https://github.com/motdotla/dotenv/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Loads environment variables from .env file", - "devDependencies": { - "decache": "^4.5.1", - "dtslint": "^0.9.8", - "flow-bin": "^0.109.0", - "sinon": "^7.5.0", - "standard": "^13.1.0", - "standard-markdown": "^5.1.0", - "standard-version": "^7.0.0", - "tap": "^14.7.0" - }, - "engines": { - "node": ">=8" - }, - "homepage": "https://github.com/motdotla/dotenv#readme", - "keywords": [ - "dotenv", - "env", - ".env", - "environment", - "variables", - "config", - "settings" - ], - "license": "BSD-2-Clause", - "main": "lib/main.js", - "name": "dotenv", - "repository": { - "type": "git", - "url": "git://github.com/motdotla/dotenv.git" - }, - "scripts": { - "dtslint": "dtslint types", - "flow": "flow", - "lint": "standard", - "postlint": "standard-markdown", - "prerelease": "npm test", - "pretest": "npm run lint && npm run dtslint", - "release": "standard-version", - "test": "tap tests/*.js --100" - }, - "standard": { - "ignore": [ - "flow-typed/" - ] - }, - "types": "types", - "version": "8.2.0" -} diff --git a/Client/node_modules/dotenv/types/tsconfig.json b/Client/node_modules/dotenv/types/tsconfig.json deleted file mode 100644 index 012b05dd0..000000000 --- a/Client/node_modules/dotenv/types/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "noEmit": true, - "baseUrl": ".", - "paths": { - "dotenv": ["."] - } - } -} diff --git a/Client/node_modules/dotenv/types/tslint.json b/Client/node_modules/dotenv/types/tslint.json deleted file mode 100644 index c634f996e..000000000 --- a/Client/node_modules/dotenv/types/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dtslint.json", - "rules": { - "strict-export-declare-modifiers": false - } -} diff --git a/Client/package-lock.json b/Client/package-lock.json index f2acc1df3..741ecce83 100644 --- a/Client/package-lock.json +++ b/Client/package-lock.json @@ -1,5 +1,5 @@ { - "name": "client", + "name": "Client", "version": "0.0.6", "lockfileVersion": 1, "requires": true, @@ -812,11 +812,6 @@ "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" }, - "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" - }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", diff --git a/Client/package.json b/Client/package.json index 654313805..0e6e7b0f3 100644 --- a/Client/package.json +++ b/Client/package.json @@ -9,7 +9,6 @@ "dependencies": { "ccxt": "^1.23.67", "child_process": "^1.0.2", - "dotenv": "^8.2.0", "open": "^6.4.0", "rimraf": "^3.0.2", "web3": "^1.3.0", diff --git a/Client/taskManagerServer.js b/Client/taskManagerServer.js index 770849e2b..0f11b1008 100644 --- a/Client/taskManagerServer.js +++ b/Client/taskManagerServer.js @@ -13,7 +13,6 @@ */ const { fork } = require('child_process') - require('dotenv').config() tasksMap = new Map() return thisObject diff --git a/Client/webSocketsServer.js b/Client/webSocketsServer.js index 4208f8913..d05279f14 100644 --- a/Client/webSocketsServer.js +++ b/Client/webSocketsServer.js @@ -9,7 +9,6 @@ run: run } - require('dotenv').config() const WEB_SOCKET = require('ws') let socketServer let port = global.env.WEB_SOCKETS_INTERFACE_PORT diff --git a/Environment.js b/Environment.js index 496e8c53c..793c1bdcb 100644 --- a/Environment.js +++ b/Environment.js @@ -17,5 +17,5 @@ exports.newEnvironment = function () { PATH_TO_FONTS: './Client/WebServer/Fonts' } - return thisObject; + return thisObject } \ No newline at end of file