From 3fa2df5bd06f26a8ae908fb75402e9838730e61f Mon Sep 17 00:00:00 2001 From: nightly Date: Thu, 20 Oct 2022 09:07:07 +0200 Subject: [PATCH] Make config.json, Make webserver respect config. --- Source/Webserver/index.ts | 4 ++-- Source/Webserver/views/index.liquid | 2 +- Source/classes/Main.ts | 2 +- config.example.json | 17 +++++++++++++++++ config.json | 18 +++++++++++++++++- 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 config.example.json diff --git a/Source/Webserver/index.ts b/Source/Webserver/index.ts index e47ff1c..a1cda97 100644 --- a/Source/Webserver/index.ts +++ b/Source/Webserver/index.ts @@ -29,7 +29,7 @@ export function startWebserver(config: any) { }); if (config) { - console.log("test"); + console.log(config.port); } // View engine options @@ -50,7 +50,7 @@ export function startWebserver(config: any) { else res.status(404).type("txt").send("404"); }); - app.listen(3430, "0.0.0.0", () => { + app.listen(config.port, "0.0.0.0", () => { console.log("Webserver running on port 3430"); }); } diff --git a/Source/Webserver/views/index.liquid b/Source/Webserver/views/index.liquid index a83abc5..3b06731 100644 --- a/Source/Webserver/views/index.liquid +++ b/Source/Webserver/views/index.liquid @@ -1,5 +1,5 @@ -{% assign pageTitle = "boom" %} +{% assign pageTitle = "MangoRecipe" %} diff --git a/Source/classes/Main.ts b/Source/classes/Main.ts index da8855d..b50e513 100644 --- a/Source/classes/Main.ts +++ b/Source/classes/Main.ts @@ -6,6 +6,6 @@ export class MangoRecipe { // Starts webservers at first boot constructor() { this.config = config; - startWebserver(this); + startWebserver(config.webapp); } } diff --git a/config.example.json b/config.example.json new file mode 100644 index 0000000..b3b7d54 --- /dev/null +++ b/config.example.json @@ -0,0 +1,17 @@ +{ + "defaultLocale": "en", + + "webapp": { + "cookieSecure": false, + "port": 6000, + "redirectURI": "http://localhost:6000/auth/callback" + }, + + "database": { + "db": "mangorecipe", + "host": "", + "password": "", + "port": 5432, + "user": "" + } +} \ No newline at end of file diff --git a/config.json b/config.json index 9e26dfe..286ec89 100644 --- a/config.json +++ b/config.json @@ -1 +1,17 @@ -{} \ No newline at end of file +{ + "defaultLocale": "en", + + "webapp": { + "cookieSecure": false, + "port": 3440, + "redirectURI": "http://localhost:6000/auth/callback" + }, + + "database": { + "db": "mangorecipe", + "host": "", + "password": "", + "port": 5432, + "user": "" + } +} \ No newline at end of file