2021-03-25 17:53:54 +01:00
|
|
|
#!/usr/bin/env bash
|
2019-03-04 18:14:58 +01:00
|
|
|
#
|
|
|
|
# Update/check the docs/sample_config.yaml
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-10-18 17:55:18 +02:00
|
|
|
cd "`dirname $0`/.."
|
2019-03-04 18:14:58 +01:00
|
|
|
|
|
|
|
SAMPLE_CONFIG="docs/sample_config.yaml"
|
2020-01-03 18:14:00 +01:00
|
|
|
SAMPLE_LOG_CONFIG="docs/sample_log_config.yaml"
|
|
|
|
|
|
|
|
check() {
|
|
|
|
diff -u "$SAMPLE_LOG_CONFIG" <(./scripts/generate_log_config) >/dev/null || return 1
|
|
|
|
}
|
2019-03-04 18:14:58 +01:00
|
|
|
|
|
|
|
if [ "$1" == "--check" ]; then
|
|
|
|
diff -u "$SAMPLE_CONFIG" <(./scripts/generate_config --header-file docs/.sample_config_header.yaml) >/dev/null || {
|
|
|
|
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
|
|
|
|
}
|
2020-01-03 18:14:00 +01:00
|
|
|
diff -u "$SAMPLE_LOG_CONFIG" <(./scripts/generate_log_config) >/dev/null || {
|
|
|
|
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 18:14:58 +01:00
|
|
|
else
|
|
|
|
./scripts/generate_config --header-file docs/.sample_config_header.yaml -o "$SAMPLE_CONFIG"
|
2020-01-03 18:14:00 +01:00
|
|
|
./scripts/generate_log_config -o "$SAMPLE_LOG_CONFIG"
|
2019-03-04 18:14:58 +01:00
|
|
|
fi
|