add just and mise tool support

This commit is contained in:
baschno
2025-12-22 11:21:20 +01:00
parent 29674ae504
commit 5abc0de38a
7 changed files with 247 additions and 1 deletions

4
env/env.local.gomplate vendored Normal file
View File

@@ -0,0 +1,4 @@
# shellcheck disable=all
LOCAL_K8S_HOST={{ .Env.LOCAL_K8S_HOST }}
SERVER_IP={{ .Env.SERVER_IP }}
AGENT_IP={{ .Env.AGENT_IP }}

69
env/justfile vendored Normal file
View File

@@ -0,0 +1,69 @@
set fallback := true
export ENV_FILE := ".env.local"
export LOCAL_K8S_HOST := env("LOCAL_K8S_HOST", "")
export SERVER_IP := env("SERVER_IP", "")
export AGENT_IP := env("AGENT_IP", "")
check:
#!/bin/bash
set -euo pipefail
if [ -z "${LOCAL_K8S_HOST}" ]; then
echo "LOCAL_K8S_HOST is not set. Please execute 'just env::setup'" >&2
exit 1
fi
if [ -z "${SERVER_IP}" ]; then
echo "SERVER_IP is not set. Please execute 'just env::setup'" >&2
exit 1
fi
if [ -z "${AGENT_IP}" ]; then
echo "AGENT_IP is not set. Please execute 'just env::setup'" >&2
exit 1
fi
setup:
#!/bin/bash
set -euo pipefail
if [ -f ../.env.local ]; then
echo ".env.local already exists." >&2
if gum confirm "Do you want to overwrite it?"; then
LOCAL_K8S_HOST=""
SERVER_IP=""
AGENT_IP=""
elif [[ $? -eq 130 ]]; then
echo "Setup cancelled by user." >&2
exit 1
else
echo "Aborting setup." >&2
exit 1
fi
fi
while [ -z "${LOCAL_K8S_HOST}" ]; do
if ! LOCAL_K8S_HOST=$(
gum input --prompt="Internal k8s hostname (for SSH): " \
--width=100 --placeholder="k8s-host"
); then
echo "Setup cancelled." >&2
exit 1
fi
done
while [ -z "${SERVER_IP}" ]; do
if ! SERVER_IP=$(
gum input --prompt="IP of Server/Master Node: " \
--width=100 --placeholder="Master Node IP"
); then
echo "Setup cancelled." >&2
exit 1
fi
done
while [ -z "${AGENT_IP}" ]; do
if ! AGENT_IP=$(
gum input --prompt="IP of Agent Node: " \
--width=100 --placeholder="Agent Node IP"
); then
echo "Setup cancelled." >&2
exit 1
fi
done
rm -f ../.env.local
gomplate -f env.local.gomplate -o ../.env.local