mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-12 19:49:59 +05:00
chore(compatibility): load infra config from config.js if infra.js is not provided
This commit is contained in:
parent
f7bfba9146
commit
33e6655fdd
@ -4,6 +4,7 @@
|
||||
|
||||
const Package = require('../package.json');
|
||||
let config;
|
||||
let isExampleConfig = false;
|
||||
const configPath = process.env.CRYPTPAD_CONFIG || "../config/config.js";
|
||||
try {
|
||||
config = require(configPath);
|
||||
@ -17,6 +18,7 @@ try {
|
||||
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");
|
||||
isExampleConfig = true;
|
||||
}
|
||||
config.version = Package.version;
|
||||
|
||||
@ -34,6 +36,15 @@ try {
|
||||
console.log("Config not found, loading the example config. You can customize the configuration by copying config/infra.example.js to " + infraPath);
|
||||
}
|
||||
infra = require("../config/infra.example");
|
||||
if (!isExampleConfig) { // if config.js is provided but not infra.js
|
||||
infra.public.origin = config.httpUnsafeOrigin || infra.public.origin;
|
||||
infra.public.sandboxOrigin = config.httpSafeOrigin || infra.public.sandboxOrigin;
|
||||
infra.public.httpHost = config.httpAddress || infra.public.httpHost;
|
||||
infra.public.httpPort = config.httpPort || infra.public.httpPort;
|
||||
infra.public.httpSafePort = config.httpSafePort || infra.public.httpSafePort;
|
||||
infra.public.externalWebsocketURL = config.externalWebsocketURL || infra.public.externalWebsocketURL;
|
||||
infra.public.fileHost = config.fileHost || infra.public.fileHost;
|
||||
}
|
||||
}
|
||||
|
||||
const isPositiveNumber = (n) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user