diff --git a/entrypoint.sh b/entrypoint.sh index c27c8c8..a6143ba 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,23 @@ #!/bin/sh -l +_yaml_to_properties() { + local yaml_file="$1" + yq -o p --properties-separator ':' '... comments = ""' "$yaml_file" +} + +_replace_dots() { + local string="$1" + local replacement="$2" + echo "$string" | awk -v rep="$replacement" 'BEGIN{FS=OFS=":"} {gsub(/\./,rep,$1); print}' +} + set -e # Read the file using yq -yq e "$1" +yq -o p --properties-separator ':' '... comments = ""' "$1" + +_properties=$(_yaml_to_properties "$YAMLPARSER_FILE_PATH") +_parsed_properties=$(_replace_dots "$properties" "_") # Use INPUT_ to get the value of an input GREETING="Hello, $INPUT_WHO_TO_GREET!"