Merge pull request #4440 from mfilser/check_environment-WRITABLE_PATH

WRITABLE_PATH must be writable, otherwise abort starting Wekan
This commit is contained in:
Lauri Ojansivu 2022-04-02 12:00:03 +03:00 committed by GitHub
commit ffba683c84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

22
server/00checkStartup.js Normal file
View file

@ -0,0 +1,22 @@
var fs = require('fs');
let error = false
if (!process.env.WRITABLE_PATH) {
console.error("WRITABLE_PATH environment variable missing and/or unset, please configure !");
error = true;
} else {
try {
fs.accessSync(process.env.WRITABLE_PATH, fs.constants.W_OK);
} catch (err) {
error = true;
console.error("can't write to " + process.env.WRITABLE_PATH, err);
console.error("the path of WRITABLE_PATH (" + process.env.WRITABLE_PATH + ") must be writable !!!");
}
}
if (error) {
console.error("Stopping Wekan");
console.error("Wekan isn't runable. Please resolve the error's above and restart Wekan !");
process.exit(1);
}