mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
Interactive Prompts
This commit is contained in:
@@ -12,19 +12,19 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
if [[ -z "$var_forgejo_instance" ]]; then
|
||||
read -rp "Forgejo Instance URL (e.g. https://code.forgejo.org): " var_forgejo_instance
|
||||
fi
|
||||
# Get required configuration with sensible fallbacks for unattended mode
|
||||
# These will show a warning if defaults are used
|
||||
var_forgejo_instance=$(prompt_input_required \
|
||||
"Forgejo Instance URL:" \
|
||||
"${var_forgejo_instance:-https://codeberg.org}" \
|
||||
120 \
|
||||
"var_forgejo_instance")
|
||||
|
||||
if [[ -z "$var_forgejo_runner_token" ]]; then
|
||||
read -rp "Forgejo Runner Registration Token: " var_forgejo_runner_token
|
||||
echo
|
||||
fi
|
||||
|
||||
if [[ -z "$var_forgejo_instance" || -z "$var_forgejo_runner_token" ]]; then
|
||||
echo "❌ Forgejo instance URL and runner token are required."
|
||||
exit 1
|
||||
fi
|
||||
var_forgejo_runner_token=$(prompt_input_required \
|
||||
"Forgejo Runner Registration Token:" \
|
||||
"${var_forgejo_runner_token:-REPLACE_WITH_YOUR_TOKEN}" \
|
||||
120 \
|
||||
"var_forgejo_runner_token")
|
||||
|
||||
export FORGEJO_INSTANCE="$var_forgejo_instance"
|
||||
export FORGEJO_RUNNER_TOKEN="$var_forgejo_runner_token"
|
||||
@@ -78,6 +78,9 @@ EOF
|
||||
systemctl enable -q --now forgejo-runner
|
||||
msg_ok "Created Services"
|
||||
|
||||
# Show warning if any required values used fallbacks
|
||||
show_missing_values_warning
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
|
||||
@@ -110,8 +110,7 @@ msg_ok "Installed garmin-grafana"
|
||||
|
||||
msg_info "Setting up garmin-grafana"
|
||||
# Check if using Chinese garmin servers
|
||||
read -rp "Are you using Garmin in mainland China? (y/N): " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes|Y)$ ]]; then
|
||||
if prompt_confirm "Are you using Garmin in mainland China?" "n" 60; then
|
||||
GARMIN_CN="True"
|
||||
else
|
||||
GARMIN_CN="False"
|
||||
@@ -131,9 +130,9 @@ EOF
|
||||
# garmin-grafana usually prompts the user for email and password (and MFA) on first run,
|
||||
# then stores a refreshable token. We try to avoid storing user credentials in the env vars
|
||||
if [ -z "$(ls -A /opt/garmin-grafana/.garminconnect)" ]; then
|
||||
read -r -p "Please enter your Garmin Connect Email: " GARMIN_EMAIL
|
||||
read -r -p "Please enter your Garmin Connect Password (this is used to generate a token and NOT stored): " GARMIN_PASSWORD
|
||||
read -r -p "Please enter your MFA Code (if applicable, leave blank if not): " GARMIN_MFA
|
||||
GARMIN_EMAIL=$(prompt_input "Please enter your Garmin Connect Email:" "" 120)
|
||||
GARMIN_PASSWORD=$(prompt_password "Please enter your Garmin Connect Password (used to generate token, NOT stored):" "" 120)
|
||||
GARMIN_MFA=$(prompt_input "Please enter your MFA Code (leave blank if not applicable):" "" 60)
|
||||
# Run the script once to prompt for credential
|
||||
msg_info "Creating Garmin credentials, this will timeout in 60 seconds"
|
||||
timeout 60s uv run --env-file /opt/garmin-grafana/.env --project /opt/garmin-grafana/ /opt/garmin-grafana/src/garmin_grafana/garmin_fetch.py <<EOF
|
||||
|
||||
Reference in New Issue
Block a user