diff --git a/.github/utils/config_conversion.sh b/.github/utils/config_conversion.sh index 5e7610959f..8eac250326 100755 --- a/.github/utils/config_conversion.sh +++ b/.github/utils/config_conversion.sh @@ -7,21 +7,37 @@ fi input_file=$1 output_file=$2 +ors_file="ors-api/src/test/files/heidelberg.osm.gz" +########################### +### Validate input file ### +########################### +# Fail if ors: can't be found +echo "Checking for ors section" +awk '/^ors:/{print "Found ors section"}' "$input_file" || exit 1 + +# For engine and source file section, make sure they are in place +echo "Checking for engine and source_file section" +awk '/ engine:/{getline; if ($0 ~ /source_file:/) {print "Found engine and source_file section"} else { exit 1 }}' "$input_file" || exit 1 + +# For profiles section for car wit enabled +echo "Checking for profiles section" +awk '/ profiles:/{getline; if ($0 ~ / car:/) {getline; if ($0 ~ / enabled:/) {print "Found profiles section"} else { exit 1 }}}' "$input_file" || exit 1 + +########################### +### Convert input file #### +########################### # Add # to the beginning of each line that is not empty or a comment awk '!/^[[:space:]]*#/ && !/^[[:space:]]*$/ {print "#" $0; next} {print}' "$input_file" > "$output_file" + # Replace '#ors:' with 'ors:' sed -i 's/#ors:/ors:/g' "$output_file" -# Replace '# engine:' with ' engine:' -sed -i 's/# engine:/ engine:/g' "$output_file" -# Replace '# source_file:' with ' source_file: ors-api/src/test/files/heidelberg.osm.gz' -sed -i 's/# source_file:/ source_file: ors-api\/src\/test\/files\/heidelberg.osm.gz/g' "$output_file" -# Replace '# profiles:' with ' profiles:' -sed -i 's/# profiles:/ profiles:/g' "$output_file" - -# Replace the individual profiles. Ignore the value of enabled and always set to false. -for profile in car ; do - awk -i inplace "/# $profile:/{getline; if (\$0 ~ /# enabled:/) {print \" $profile:\"; print \" enabled: true\"; next}} {print}" "$output_file" -done + + +# Remove the comments for the engine and source_file section +awk -i inplace "/engine:/{getline; if (\$0 ~ /source_file:/) {print \" engine:\"; print \" source_file: '$ors_file'\"; next} else { exit1 }} {print}" "$output_file" + +# Remove the comments for the profiles section for car +awk -i inplace "/# profiles:/{getline; if (\$0 ~ /# car:/) {getline; if (\$0 ~ /# enabled:/) {print \" profiles:\"; print \" car:\"; print \" enabled: true\"; next}}}{print}" "$output_file" echo "Parsing complete. Result saved to $output_file" diff --git a/ors-api/src/main/resources/application.yml b/ors-api/src/main/resources/application.yml index 09b923f418..0cd4261ccf 100644 --- a/ors-api/src/main/resources/application.yml +++ b/ors-api/src/main/resources/application.yml @@ -101,9 +101,9 @@ ors: ##### ORS engine settings ##### engine: + source_file: init_threads: 1 preparation_mode: false - source_file: graphs_root_path: ./graphs graphs_data_access: RAM_STORE elevation: