init.initialise() checks for correct path of config.json (bug fix)

This commit is contained in:
2025-08-09 12:51:43 +01:00
parent 144c276bc9
commit 49c7fc7cdf
2 changed files with 3 additions and 39 deletions

View File

@@ -1,36 +0,0 @@
{
"seperator": "<hr/>",
"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: <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs'>Source Code</a>, <a href='https://git.javalsai.tuxcord.net/deadvey/blogger-nodejs/raw/branch/master/LICENSE'>license (WTFPL)</a>"
},
"css": ""
}

View File

@@ -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")
})
}