1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Drop the config schema generation subcommand & include it in the docs

This commit is contained in:
Quentin Gliech
2022-10-17 10:21:05 +02:00
parent f5e3aa0404
commit eeae943208
6 changed files with 1159 additions and 18 deletions

View File

@@ -14,7 +14,6 @@
use clap::Parser;
use mas_config::{ConfigurationSection, RootConfig};
use schemars::gen::SchemaSettings;
use tracing::info;
#[derive(Parser, Debug)]
@@ -28,9 +27,6 @@ enum Subcommand {
/// Dump the current config as YAML
Dump,
/// Print the JSON Schema that validates configuration files
Schema,
/// Check a config file
Check,
@@ -49,18 +45,6 @@ impl Options {
Ok(())
}
SC::Schema => {
let settings = SchemaSettings::draft07().with(|s| {
s.option_nullable = false;
s.option_add_null_type = false;
});
let gen = settings.into_generator();
let schema = gen.into_root_schema_for::<RootConfig>();
serde_yaml::to_writer(std::io::stdout(), &schema)?;
Ok(())
}
SC::Check => {
let _config: RootConfig = root.load_config()?;
info!(path = ?root.config, "Configuration file looks good");