Skip to content

Commit

Permalink
fix(config): Add some additional parsing and validating steps
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelsJP committed Feb 7, 2024
1 parent 6af5e38 commit b28103e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .github/utils/yml_config_to_properties_conversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,30 @@ yq --exit-status '(.ors.engine.source_file == null)' $input_file || exit 1
###########################
echo "Replacing source_file with ors-api/src/test/files/heidelberg.osm.gz"
# Output the converted yml to the final file temporarily
yq e '.ors.engine.source_file="ors-api/src/test/files/heidelberg.osm.gz"' $input_file > $output_file || exit 1
yq e '.ors.engine.source_file = "ors-api/src/test/files/heidelberg.osm.gz"' $input_file > $output_file || exit 1
echo "Replacing ors.engine.profiles.car.enabled='false' with ors.engine.profiles.car.enabled='true'"
yq e '.ors.engine.profiles.car.enabled = "true"' -i $output_file || exit 1
yq e '.ors.engine.profiles.car.enabled = true' -i $output_file || exit 1


############################
### Validate output file ###
############################
echo "Checking if the output file is a valid yaml file"
yq 'true' $output_file /dev/null || exit 1
echo "Checking for ors.engine.source_file=ors-api/src/test/files/heidelberg.osm.gz"
return_value=$(sed -n '/^
ors.engine.source_file=ors-api\/src\/test\/files\/heidelberg.osm.gz/p') $output_file || exit 1
if [ -z "$return_value" ]; then
echo "ors.engine.source_file=ors-api/src/test/files/heidelberg.osm.gz not found"
exit 1
fi
echo "Checking for ors.engine.profiles.car.enabled=true"
return_value=$(sed -n '/^ors.engine.profiles.car.enabled=true/p') $output_file || exit 1
if [ -z "$return_value" ]; then
echo "ors.engine.profiles.car.enabled=true not found"
exit 1
fi


###########################
### Convert input file ####
Expand Down

0 comments on commit b28103e

Please sign in to comment.