Load a default config when a default can't be located

The config package will use default.yaml for us, but most deployments won't have set that up correctly so instead we offer sensible defaults in addition to the thing from config.
This commit is contained in:
Travis Ralston 2020-02-12 15:38:52 -07:00
parent 9e5c87ac56
commit f7448564be

View File

@ -57,4 +57,42 @@ interface IConfig {
};
}
export default <IConfig>config;
const defaultConfig: IConfig = {
homeserverUrl: "http://localhost:8008",
accessToken: "NONE_PROVIDED",
pantalaimon: {
use: false,
username: "",
password: "",
},
dataPath: "/data/storage",
autojoin: false,
autojoinOnlyIfManager: false,
managementRoom: "!noop:example.org",
verboseLogging: false,
logLevel: "INFO",
syncOnStartup: true,
verifyPermissionsOnStartup: true,
noop: false,
protectedRooms: [],
fasterMembershipChecks: false,
automaticallyRedactForReasons: ["spam", "advertising"],
protectAllJoinedRooms: false,
banListServer: {
enabled: false,
bind: "0.0.0.0",
port: 5186,
},
commands: {
allowNoPrefix: false,
additionalPrefixes: [],
},
// Needed to make the interface happy.
RUNTIME: {
client: null,
},
};
const finalConfig = <IConfig>Object.assign({}, defaultConfig, config);
export default finalConfig;