From c09546f916e7fd7ea276120fe71115f5e12fc470 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 8 Dec 2025 21:20:27 +0100 Subject: [PATCH] feat: add Gitea registry authentication support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add gitea_registry, gitea_user, gitea_token to config.json parsing - Pass Gitea credentials to setup.sh via --gitea-* arguments - Add docker login for Gitea registry in setup.sh - Supports both Docker Hub and Gitea registries simultaneously 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- script/setup.sh | 23 +++++++++++++++++++++++ script/start.sh | 11 +++++++++++ 2 files changed, 34 insertions(+) diff --git a/script/setup.sh b/script/setup.sh index bc4d333..5cb913f 100644 --- a/script/setup.sh +++ b/script/setup.sh @@ -31,6 +31,11 @@ DOCKER_USER="" DOCKER_TOKEN="" DOCKER_REGISTRY="" +# Gitea registry authentication (for private images from code.letsbe.solutions) +GITEA_REGISTRY="" +GITEA_USER="" +GITEA_TOKEN="" + while [[ $# -gt 0 ]]; do case $1 in --tools) @@ -61,6 +66,18 @@ while [[ $# -gt 0 ]]; do DOCKER_REGISTRY="$2" shift 2 ;; + --gitea-registry) + GITEA_REGISTRY="$2" + shift 2 + ;; + --gitea-user) + GITEA_USER="$2" + shift 2 + ;; + --gitea-token) + GITEA_TOKEN="$2" + shift 2 + ;; --help|-h) echo "Usage: $0 [--tools \"tool1,tool2,...\"|\"all\"] [--domain DOMAIN] [--skip-ssl] [--root-ssl]" echo "" @@ -129,6 +146,12 @@ if [[ -n "$DOCKER_USER" && -n "$DOCKER_TOKEN" ]]; then fi fi +# Gitea registry login (for private images from code.letsbe.solutions) +if [[ -n "$GITEA_REGISTRY" && -n "$GITEA_USER" && -n "$GITEA_TOKEN" ]]; then + echo "Logging into Gitea registry: $GITEA_REGISTRY..." + echo "$GITEA_TOKEN" | docker login -u "$GITEA_USER" --password-stdin "$GITEA_REGISTRY" +fi + # ============================================================================= # DISABLE CONFLICTING SERVICES # ============================================================================= diff --git a/script/start.sh b/script/start.sh index 5b58556..a87c730 100644 --- a/script/start.sh +++ b/script/start.sh @@ -62,6 +62,11 @@ DOCKER_USER="" DOCKER_TOKEN="" DOCKER_REGISTRY="" +# Gitea registry authentication (for private images) +GITEA_REGISTRY="" +GITEA_USER="" +GITEA_TOKEN="" + # ============================================================================= # HELPER FUNCTIONS # ============================================================================= @@ -139,6 +144,9 @@ parse_json() { DOCKER_USER=$(echo "$json" | jq -r '.docker_user // empty') DOCKER_TOKEN=$(echo "$json" | jq -r '.docker_token // empty') DOCKER_REGISTRY=$(echo "$json" | jq -r '.docker_registry // empty') + GITEA_REGISTRY=$(echo "$json" | jq -r '.gitea_registry // empty') + GITEA_USER=$(echo "$json" | jq -r '.gitea_user // empty') + GITEA_TOKEN=$(echo "$json" | jq -r '.gitea_token // empty') # Registration token (can also be set via environment variable) local json_token=$(echo "$json" | jq -r '.registration_token // empty') @@ -381,6 +389,9 @@ if [[ "$ACTION" == "setup" ]]; then [[ -n "$DOCKER_USER" ]] && SETUP_ARGS="$SETUP_ARGS --docker-user $(printf '%q' "$DOCKER_USER")" [[ -n "$DOCKER_TOKEN" ]] && SETUP_ARGS="$SETUP_ARGS --docker-token $(printf '%q' "$DOCKER_TOKEN")" [[ -n "$DOCKER_REGISTRY" ]] && SETUP_ARGS="$SETUP_ARGS --docker-registry $(printf '%q' "$DOCKER_REGISTRY")" + [[ -n "$GITEA_REGISTRY" ]] && SETUP_ARGS="$SETUP_ARGS --gitea-registry $(printf '%q' "$GITEA_REGISTRY")" + [[ -n "$GITEA_USER" ]] && SETUP_ARGS="$SETUP_ARGS --gitea-user $(printf '%q' "$GITEA_USER")" + [[ -n "$GITEA_TOKEN" ]] && SETUP_ARGS="$SETUP_ARGS --gitea-token $(printf '%q' "$GITEA_TOKEN")" # Run setup.sh directly in foreground (connection stays alive with PermitRootLogin yes) echo "Running setup.sh (this may take 10-15 minutes)..."