2021-03-25 10:53:54 -06:00
|
|
|
#!/usr/bin/env bash
|
2019-03-04 10:14:58 -07:00
|
|
|
#
|
|
|
|
# Update/check the docs/sample_config.yaml
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-10-22 16:07:23 -06:00
|
|
|
cd "$(dirname "$0")/.."
|
2019-03-04 10:14:58 -07:00
|
|
|
|
|
|
|
SAMPLE_CONFIG="docs/sample_config.yaml"
|
2020-01-03 10:14:00 -07:00
|
|
|
SAMPLE_LOG_CONFIG="docs/sample_log_config.yaml"
|
|
|
|
|
|
|
|
check() {
|
2022-03-02 06:00:16 -07:00
|
|
|
diff -u "$SAMPLE_LOG_CONFIG" <(synapse/_scripts/generate_log_config.py) >/dev/null || return 1
|
2020-01-03 10:14:00 -07:00
|
|
|
}
|
2019-03-04 10:14:58 -07:00
|
|
|
|
|
|
|
if [ "$1" == "--check" ]; then
|
2022-03-02 06:00:16 -07:00
|
|
|
diff -u "$SAMPLE_CONFIG" <(synapse/_scripts/generate_config.py --header-file docs/.sample_config_header.yaml) >/dev/null || {
|
2019-03-04 10:14:58 -07:00
|
|
|
echo -e "\e[1m\e[31m$SAMPLE_CONFIG is not up-to-date. Regenerate it with \`scripts-dev/generate_sample_config\`.\e[0m" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
2022-03-02 06:00:16 -07:00
|
|
|
diff -u "$SAMPLE_LOG_CONFIG" <(synapse/_scripts/generate_log_config.py) >/dev/null || {
|
2020-01-03 10:14:00 -07:00
|
|
|
echo -e "\e[1m\e[31m$SAMPLE_LOG_CONFIG is not up-to-date. Regenerate it with \`scripts-dev/generate_sample_config\`.\e[0m" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
2019-03-04 10:14:58 -07:00
|
|
|
else
|
2022-03-02 06:00:16 -07:00
|
|
|
synapse/_scripts/generate_config.py --header-file docs/.sample_config_header.yaml -o "$SAMPLE_CONFIG"
|
|
|
|
synapse/_scripts/generate_log_config.py -o "$SAMPLE_LOG_CONFIG"
|
2019-03-04 10:14:58 -07:00
|
|
|
fi
|