From f7448564bef421b7673b21dbd448f216a63ae51e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 12 Feb 2020 15:38:52 -0700 Subject: [PATCH] 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. --- src/config.ts | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index b85890b..768af67 100644 --- a/src/config.ts +++ b/src/config.ts @@ -57,4 +57,42 @@ interface IConfig { }; } -export default 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 = Object.assign({}, defaultConfig, config); +export default finalConfig;