diff --git a/bootstrap.sh b/bootstrap.sh index 08e2d76..ac72bfc 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -40,24 +40,46 @@ info "Prerequisites OK" # ── Credentials (collected upfront before any private repo clones) ───────────── section "Credentials" -echo "" -prompt "Enter CONTENT_API_KEY for glitch.university (find it in the VPS .env): " -read -r -s CONTENT_API_KEY -echo "" +# Load previously saved values from .env if it exists +if [[ -f "${REPO_DIR}/.env" ]]; then + source "${REPO_DIR}/.env" +fi -echo "" -prompt "Enter Gitea personal access token (needs repo read access — create at https://${GITEA_HOST}/user/settings/applications): " -read -r -s GITEA_TOKEN_BOOTSTRAP -echo "" +if [[ -n "${CONTENT_API_KEY:-}" ]]; then + info "CONTENT_API_KEY already set: ${CONTENT_API_KEY}" +else + echo "" + prompt "Enter CONTENT_API_KEY for glitch.university (find it in the VPS .env): " + read -r -s CONTENT_API_KEY + echo "" +fi -echo "" -prompt "Enter Agent0 login username: " -read -r AUTH_LOGIN -prompt "Enter Agent0 login password: " -read -r -s AUTH_PASSWORD -echo "" +if [[ -n "${GITEA_TOKEN_BOOTSTRAP:-}" ]]; then + info "Gitea token already set: ${GITEA_TOKEN_BOOTSTRAP}" +else + echo "" + prompt "Enter Gitea personal access token (needs repo read access — create at https://${GITEA_HOST}/user/settings/applications): " + read -r -s GITEA_TOKEN_BOOTSTRAP + echo "" +fi -info "Credentials collected" +if [[ -n "${AUTH_LOGIN:-}" ]]; then + info "Agent0 login already set: ${AUTH_LOGIN}" +else + echo "" + prompt "Enter Agent0 login username: " + read -r AUTH_LOGIN +fi + +if [[ -n "${AUTH_PASSWORD:-}" ]]; then + info "Agent0 password already set" +else + prompt "Enter Agent0 login password: " + read -r -s AUTH_PASSWORD + echo "" +fi + +info "Credentials ready" # ── Ollama ──────────────────────────────────────────────────────────────────── section "Ollama" @@ -239,15 +261,13 @@ section "Docker containers" cd "$REPO_DIR" -if [[ ! -f "${REPO_DIR}/.env" ]]; then - cat > "${REPO_DIR}/.env" << EOF +cat > "${REPO_DIR}/.env" << EOF AUTH_LOGIN=${AUTH_LOGIN} AUTH_PASSWORD=${AUTH_PASSWORD} +CONTENT_API_KEY=${CONTENT_API_KEY} +GITEA_TOKEN_BOOTSTRAP=${GITEA_TOKEN_BOOTSTRAP} EOF - info "Agent0 .env created" -else - info "Agent0 .env already exists" -fi +info "Agent0 .env written" info "Building glitch-tunnel image..." docker compose build --quiet