From 10cb3bb0650e0806f2835cbbbe3852d5ddf7454f Mon Sep 17 00:00:00 2001 From: Jairon Alves Lima Date: Thu, 4 Apr 2024 23:53:49 -0300 Subject: [PATCH] feat: v1 --- entrypoint.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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!"