2019-09-26 02:13:20 +00:00
|
|
|
/*
|
2020-01-26 03:34:15 +00:00
|
|
|
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
|
2019-09-26 02:13:20 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import * as config from "config";
|
2019-11-07 01:46:49 +00:00
|
|
|
import { MatrixClient } from "matrix-bot-sdk";
|
2019-09-26 02:13:20 +00:00
|
|
|
|
|
|
|
interface IConfig {
|
|
|
|
homeserverUrl: string;
|
|
|
|
accessToken: string;
|
2019-10-03 04:20:37 +00:00
|
|
|
pantalaimon: {
|
|
|
|
use: boolean;
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
};
|
2019-09-26 02:13:20 +00:00
|
|
|
dataPath: string;
|
2020-03-05 22:29:30 +00:00
|
|
|
acceptInvitesFromGroup: string;
|
2020-01-21 20:53:02 +00:00
|
|
|
autojoinOnlyIfManager: boolean;
|
2020-03-05 22:38:09 +00:00
|
|
|
recordIgnoredInvites: boolean;
|
2019-09-27 19:57:36 +00:00
|
|
|
managementRoom: string;
|
2019-10-05 02:59:30 +00:00
|
|
|
verboseLogging: boolean;
|
2019-10-31 15:55:34 +00:00
|
|
|
logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR";
|
2019-10-05 03:02:37 +00:00
|
|
|
syncOnStartup: boolean;
|
2019-10-05 03:22:34 +00:00
|
|
|
verifyPermissionsOnStartup: boolean;
|
2019-10-09 13:51:30 +00:00
|
|
|
noop: boolean;
|
2019-09-27 20:36:23 +00:00
|
|
|
protectedRooms: string[]; // matrix.to urls
|
2019-11-07 01:54:59 +00:00
|
|
|
fasterMembershipChecks: boolean;
|
2019-12-10 02:56:12 +00:00
|
|
|
automaticallyRedactForReasons: string[]; // case-insensitive globs
|
2020-01-21 22:19:03 +00:00
|
|
|
protectAllJoinedRooms: boolean;
|
2020-02-12 22:27:27 +00:00
|
|
|
commands: {
|
|
|
|
allowNoPrefix: boolean;
|
|
|
|
additionalPrefixes: string[];
|
|
|
|
};
|
2019-11-07 01:46:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Config options only set at runtime. Try to avoid using the objects
|
|
|
|
* here as much as possible.
|
|
|
|
*/
|
|
|
|
RUNTIME: {
|
|
|
|
client: MatrixClient;
|
|
|
|
};
|
2019-09-26 02:13:20 +00:00
|
|
|
}
|
|
|
|
|
2020-02-12 22:38:52 +00:00
|
|
|
const defaultConfig: IConfig = {
|
|
|
|
homeserverUrl: "http://localhost:8008",
|
|
|
|
accessToken: "NONE_PROVIDED",
|
|
|
|
pantalaimon: {
|
|
|
|
use: false,
|
|
|
|
username: "",
|
|
|
|
password: "",
|
|
|
|
},
|
|
|
|
dataPath: "/data/storage",
|
2020-03-05 22:29:30 +00:00
|
|
|
acceptInvitesFromGroup: '+example:example.org',
|
2020-02-12 22:38:52 +00:00
|
|
|
autojoinOnlyIfManager: false,
|
2020-03-05 22:38:09 +00:00
|
|
|
recordIgnoredInvites: false,
|
2020-02-12 22:38:52 +00:00
|
|
|
managementRoom: "!noop:example.org",
|
|
|
|
verboseLogging: false,
|
|
|
|
logLevel: "INFO",
|
|
|
|
syncOnStartup: true,
|
|
|
|
verifyPermissionsOnStartup: true,
|
|
|
|
noop: false,
|
|
|
|
protectedRooms: [],
|
|
|
|
fasterMembershipChecks: false,
|
|
|
|
automaticallyRedactForReasons: ["spam", "advertising"],
|
|
|
|
protectAllJoinedRooms: false,
|
|
|
|
commands: {
|
|
|
|
allowNoPrefix: false,
|
|
|
|
additionalPrefixes: [],
|
|
|
|
},
|
|
|
|
|
|
|
|
// Needed to make the interface happy.
|
|
|
|
RUNTIME: {
|
|
|
|
client: null,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const finalConfig = <IConfig>Object.assign({}, defaultConfig, config);
|
|
|
|
export default finalConfig;
|