make the config path configurable

This commit is contained in:
zimbatm 2019-05-14 21:43:19 +02:00
parent 04cddf58cf
commit 35dd3abbb5
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7
1 changed files with 5 additions and 2 deletions

View File

@ -1,11 +1,14 @@
/* jslint node: true */
"use strict";
var config;
var configPath = process.env.CRYPTPAD_CONFIG || "../config/config";
try {
config = require("../config/config");
config = require(configPath);
if (config.adminEmail === 'i.did.not.read.my.config@cryptpad.fr') {
console.log("You can configure the administrator email (adminEmail) in your config/config.js file");
}
} catch (e) {
console.log("You can customize the configuration by copying config/config.example.js to config/config.js");
console.log("Config not found, loading the example config. You can customize the configuration by copying config/config.example.js to " + configPath);
config = require("../config/config.example");
}
module.exports = config;