Skip to content

Commit

Permalink
fix(config): Adjust the parsing of the application.yml
Browse files Browse the repository at this point in the history
The removal of comments is now tailored down to very specific parts to avoid namespace clashes.
Additionally, the source file has the heidelberg pbf as a default.
  • Loading branch information
MichaelsJP committed Jan 30, 2024
1 parent 60146f7 commit 7e326ad
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/utils/config_conversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ fi

input_file=$1
output_file=$2
ors_file="ors-api/src/test/files/heidelberg.osm.gz"


# 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: "YOUR_FILE"'
sed -i 's/# source_file:/ source_file: "YOUR_FILE"/g' "$output_file"
# Replace '# profiles:' with ' profiles:'
sed -i 's/# profiles:/ profiles:/g' "$output_file"
# Remove the comments for car and set the profile to true in all cases
awk -i inplace "/# car:/{getline; if (\$0 ~ /# enabled:/) {print \" car:\"; print \" enabled: true\"; next}} {print}" "$output_file"

# 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}} {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"

0 comments on commit 7e326ad

Please sign in to comment.