added install script + reworked pipeline
Some checks failed
Tests / Run Go Tests (push) Failing after 18s

This commit is contained in:
2025-11-30 19:54:00 +01:00
parent 8cb63d3342
commit dd8a29acc2
7 changed files with 75 additions and 21 deletions

View File

@@ -30,16 +30,60 @@ if [ ! -f $envFile ]; then
echo ".env not found. Creating interactively from .env.example."
> $envFile
while IFS="=" read -r key val; do
[[ "$key" =~ ^#.*$ || -z "$key" ]] && continue
default_value=$(echo "$val" | sed 's/"//g')
printf "Value for $key (default: $default_value): "
read -r user_value < /dev/tty
if [ -z "$user_value" ]; then
echo "$key=$default_value" >> $envFile
else
echo "$key=$user_value" >> $envFile
while IFS= read -r line; do
#ignore empty lines and comments
[[ "$line" =~ ^#.*$ || -z "$line" ]] && continue
key=$(printf "%s" "$line" | cut -d '=' -f 1)
rest=$(printf "%s" "$line" | cut -d '=' -f 2-)
# extract inline comment portion
comment=$(printf "%s" "$rest" | sed -n 's/.*# \(.*\)$/\1/p')
raw_val=$(printf "%s" "$rest" | sed 's/ *#.*//')
default_value=$(printf "%s" "$raw_val" | sed 's/"//g')
regex=""
if [[ "$comment" =~ regex:(.*)$ ]]; then
regex="${BASH_REMATCH[1]}"
fi
comment=$(printf "%s" "$comment" | sed 's/ regex:.*//')
while true; do
if [ -z "$comment" ]; then
printf "Value for $key - $comment (default: $default_value"
else
printf "Value for $key (default: $default_value"
fi
if [ -n "$regex" ]; then
printf ", must match: %s" "$regex"
fi
printf "):\n"
read user_input < /dev/tty
# empty input -> take default
[ -z "$user_input" ] && user_input="$default_value"
printf "\e[A$user_input\n"
# validate
if [ -n "$regex" ]; then
if [[ "$user_input" =~ $regex ]]; then
echo "$key=$user_input" >> $envFile
break
else
printf "Invalid value. Does not match regex: %s\n" "$regex"
continue
fi
else
echo "$key=$user_input" >> $envFile
break
fi
done
done < $envExample
echo ".env created."
@@ -55,6 +99,7 @@ fi
echo "Start containers with docker compose up -d? [y/N]"
read -r start_containers
if [[ "$start_containers" =~ ^[Yy]$ ]]; then
cd Docker
docker compose up -d
echo "Containers started."
else