2021-03-25 12:53:54 -04:00
|
|
|
#!/usr/bin/env bash
|
2019-03-04 12:14:58 -05:00
|
|
|
#
|
|
|
|
# Update/check the docs/sample_config.yaml
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd `dirname $0`/..
|
|
|
|
|
|
|
|
SAMPLE_CONFIG="docs/sample_config.yaml"
|
2020-01-03 12:14:00 -05: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 12:14:58 -05: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 12:14:00 -05: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 12:14:58 -05:00
|
|
|
else
|
|
|
|
./scripts/generate_config --header-file docs/.sample_config_header.yaml -o "$SAMPLE_CONFIG"
|
2020-01-03 12:14:00 -05:00
|
|
|
./scripts/generate_log_config -o "$SAMPLE_LOG_CONFIG"
|
2019-03-04 12:14:58 -05:00
|
|
|
fi
|