From 9d58415403ebf70f1d704203212b1933dced8822 Mon Sep 17 00:00:00 2001 From: Michael Feng Date: Mon, 6 Feb 2023 15:41:59 -0800 Subject: [PATCH] clean up certs path --- src/https.ts | 34 ++++++++++++------- .../schema/ethereum-gas-station-schema.json | 12 ------- src/templates/server.yml | 2 +- src/templates/telemetry.yml | 2 -- 4 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 src/services/schema/ethereum-gas-station-schema.json delete mode 100644 src/templates/telemetry.yml diff --git a/src/https.ts b/src/https.ts index 10bc3dc60b..11f61b6fa2 100644 --- a/src/https.ts +++ b/src/https.ts @@ -6,23 +6,24 @@ import { ConfigManagerV2 } from './services/config-manager-v2'; export const addHttps = (app: Application) => { const serverKey = fs.readFileSync( - ConfigManagerV2.getInstance().get('server.certificatePath') + 'server_key.pem', - { - encoding: 'utf-8', - } + addSlashToPath( + ConfigManagerV2.getInstance().get('server.certificatePath') + ) + 'server_key.pem', + { encoding: 'utf-8' } ); + const serverCert = fs.readFileSync( - ConfigManagerV2.getInstance().get('server.certificatePath') + - 'server_cert.pem', - { - encoding: 'utf-8', - } + addSlashToPath( + ConfigManagerV2.getInstance().get('server.certificatePath') + ) + 'server_cert.pem', + { encoding: 'utf-8' } ); + const caCert = fs.readFileSync( - ConfigManagerV2.getInstance().get('server.certificatePath') + 'ca_cert.pem', - { - encoding: 'utf-8', - } + addSlashToPath( + ConfigManagerV2.getInstance().get('server.certificatePath') + ) + 'ca_cert.pem', + { encoding: 'utf-8' } ); return https.createServer( @@ -40,3 +41,10 @@ export const addHttps = (app: Application) => { app ); }; + +const addSlashToPath = (path: string) => { + if (!path.endsWith('/')) { + path += '/'; + } + return path; +}; diff --git a/src/services/schema/ethereum-gas-station-schema.json b/src/services/schema/ethereum-gas-station-schema.json deleted file mode 100644 index 8c35c86066..0000000000 --- a/src/services/schema/ethereum-gas-station-schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "enabled": { "type": "boolean" }, - "gasStationURL": { "type": "string" }, - "APIKey": { "type": ["string", "null"] }, - "gasLevel": { "enum": ["fast", "fastest", "safeLow", "average"] } - }, - "additionalProperties": false, - "required": ["enabled"] -} diff --git a/src/templates/server.yml b/src/templates/server.yml index 67f2b9ecc7..7a331a66bd 100644 --- a/src/templates/server.yml +++ b/src/templates/server.yml @@ -1,5 +1,5 @@ # Path to folder where Hummingbot generates self-signed certificates -certificatePath: /Users/feng1/Code/hummingbot/certs/ +certificatePath: /certs/ # Path to folder where logs will be stored. logPath: './logs' diff --git a/src/templates/telemetry.yml b/src/templates/telemetry.yml deleted file mode 100644 index d8e96575f4..0000000000 --- a/src/templates/telemetry.yml +++ /dev/null @@ -1,2 +0,0 @@ -# If true it will collect data about API usage. -enabled: false