From 49c7fc7cdf5407ad1bdd70b33316a119b7db7b87 Mon Sep 17 00:00:00 2001 From: DeaDvey Date: Sat, 9 Aug 2025 12:51:43 +0100 Subject: [PATCH] init.initialise() checks for correct path of config.json (bug fix) --- data/example-config.json | 36 ------------------------------------ src/initialise.js | 6 +++--- 2 files changed, 3 insertions(+), 39 deletions(-) delete mode 100755 data/example-config.json diff --git a/data/example-config.json b/data/example-config.json deleted file mode 100755 index 5df69d6..0000000 --- a/data/example-config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "seperator": "
", - "site_name": "My Blog", - "site_url": "https://example.com", - "language": "en", - "port": 8080, - "allow_signup": true, - "site_description": "Read my blogs!", - "timeline_length": 20, - "enable_hitcount": true, - "charset": "UTF-8", - "root_path": "/home/deadvey/code/web/webroot/", - "edit_account_base_url": "/edit_account", - "new_post_url": "/post", - "signup_url": "/signup", - "edit_post_base_url": "/edit", - "default_comenter_username": "Anon", - "rss": true, - "atom": true, - "date_format": "yyyy-MM-dd", - "time_zone": "+0000", - "string": { - "signup_agreement": "I agree to not post illegal or hateful content", - "signups_unavailable": "Sorry, this server does not allow signups", - "user_exists": "Sorry, this user already exists, try a different username", - "user_doesnt_exist": "Sorry, this user does not exist", - "comment_doesnt_exist": "This comment doesn't exist, this could be because the post it was attached to was deleted", - "post_doesnt_exist": "This post doesn't exist or was deleted", - "delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)", - "incorrect_password": "Incorrect Password", - "rss_disabled": "Sorry, RSS is disabled", - "atom_disabled": "Sorry, ATOM is disabled", - "attribution": "Powered by blogger-nodejs: Source Code, license (WTFPL)" - }, - "css": "" -} diff --git a/src/initialise.js b/src/initialise.js index 4c0c598..9be4c60 100644 --- a/src/initialise.js +++ b/src/initialise.js @@ -28,12 +28,12 @@ export function initialise() { fs.writeFileSync(`../data/comments.json`, `{\n"comments": [],\n"counter": 0}`) } try { - const config = require("../data/config.json"); + const config = require("../config.json"); } catch (error) { console.log("Copying the example config to config.js") - console.log("!!! PLEASE MODIFY config.js TO YOUR NEEDS !!!") - fs.copyFile('example-config.json', 'config.json', (err) => { + console.log("!!! PLEASE MODIFY config.json TO YOUR NEEDS !!!") + fs.copyFile('../example-config.json', '../config.json', (err) => { console.log("Error copying file") }) }