From b2ff77e7d362d16d4aef8c3561910186f278c557 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 27 Oct 2024 22:32:36 +0100 Subject: [PATCH] Add app in config --- instances/default/config.json | 4 ++++ src/core/config.js | 2 ++ src/core/routes.js | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/instances/default/config.json b/instances/default/config.json index 8f9c326..5c0de57 100644 --- a/instances/default/config.json +++ b/instances/default/config.json @@ -1,4 +1,8 @@ { + "app": { + "name": "Secret Sender", + "url": "https://127.0.0.1:3443" + }, "servers": [ { "features": { diff --git a/src/core/config.js b/src/core/config.js index 77e7300..4013326 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -10,6 +10,8 @@ const load = () => { throw new Error('Config file not found') } _config = JSON.parse(fs.readFileSync(_configFile)) + if(! _config.app) _config.app = {} + if(! _config.app.name) _config.app.name = 'Secret Sender' } if(! _config) load() diff --git a/src/core/routes.js b/src/core/routes.js index ca9066e..c9ec1ed 100644 --- a/src/core/routes.js +++ b/src/core/routes.js @@ -1,7 +1,9 @@ import bodyParser from "body-parser" +import config from "./config.js" import vault from "./vault.js" -const _title = "Secret Sender" +const _config = config.get() +const _title = _config.app.name const load = (router, features) => {