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