mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
parent
d860b9acd1
commit
7be3458e8d
1
changelog.d/125.feature
Normal file
1
changelog.d/125.feature
Normal file
@ -0,0 +1 @@
|
||||
Add new script `validate-config` which check your config file for simple errors.
|
@ -52,6 +52,8 @@ Copy the `config.sample.yml` to a new file `config.yml`. The sample config is al
|
||||
|
||||
You should read and fill this in as the bridge will not start without a complete config.
|
||||
|
||||
You may validate your config without starting the service by running `yarn validate-config`.
|
||||
|
||||
Copy `registration.sample.yml` into `registration.yml` and fill in:
|
||||
- At a minimum, you will need to replace the `as_token` and `hs_token` and change the domain part of the namespaces.
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
"lint": "yarn run lint:js && yarn run lint:rs",
|
||||
"lint:js": "eslint -c .eslintrc.js src/**/*.ts",
|
||||
"lint:rs": "cargo fmt --all -- --check",
|
||||
"generate-default-config": "ts-node src/Config/Defaults.ts --config > config.sample.yml"
|
||||
"generate-default-config": "ts-node src/Config/Defaults.ts --config > config.sample.yml",
|
||||
"validate-config": "ts-node src/Config/Config.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
|
@ -272,3 +272,17 @@ export async function parseRegistrationFile(filename: string) {
|
||||
const file = await fs.readFile(filename, "utf-8");
|
||||
return YAML.parse(file) as IAppserviceRegistration;
|
||||
}
|
||||
|
||||
|
||||
// Can be called directly
|
||||
if (require.main === module) {
|
||||
BridgeConfig.parseConfig(process.argv[2] || "config.yml", process.env).then(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Config successfully validated.');
|
||||
process.exit(0);
|
||||
}).catch(ex => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error in config:', ex);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user