Refactor installation scripts to use new configuration prompt helpers for improved user experience

This commit is contained in:
2025-06-29 15:40:56 -07:00
parent dab2551471
commit 8f513235e2
11 changed files with 90 additions and 156 deletions

View File

@@ -2,17 +2,13 @@
set -e
set -o pipefail
# Source common utilities
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../bin/wild-common.sh"
# Initialize Wild-Cloud environment
init_wild_env
if [ -z "${WC_HOME}" ]; then
echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)"
exit 1
fi
source "${WC_ROOT}/bin/wild-common.sh"
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
NFS_DIR="${CLUSTER_SETUP_DIR}/nfs"
@@ -21,22 +17,10 @@ print_header "Registering NFS server with Kubernetes cluster"
# Collect required configuration variables
print_info "Collecting NFS configuration..."
# Get current values
current_nfs_host=$(get_current_config "cloud.nfs.host")
current_media_path=$(get_current_config "cloud.nfs.mediaPath")
current_storage_capacity=$(get_current_config "cloud.nfs.storageCapacity")
# Prompt for NFS host
nfs_host=$(prompt_with_default "Enter NFS server hostname or IP address" "192.168.1.100" "${current_nfs_host}")
wild-config-set "cloud.nfs.host" "${nfs_host}"
# Prompt for NFS media path
media_path=$(prompt_with_default "Enter NFS export path for media storage" "/mnt/storage/media" "${current_media_path}")
wild-config-set "cloud.nfs.mediaPath" "${media_path}"
# Prompt for storage capacity
storage_capacity=$(prompt_with_default "Enter NFS storage capacity (e.g., 1Ti, 500Gi)" "1Ti" "${current_storage_capacity}")
wild-config-set "cloud.nfs.storageCapacity" "${storage_capacity}"
# Prompt for configuration using helper functions
prompt_if_unset_config "cloud.nfs.host" "Enter NFS server hostname or IP address" "192.168.1.100"
prompt_if_unset_config "cloud.nfs.mediaPath" "Enter NFS export path for media storage" "/mnt/storage/media"
prompt_if_unset_config "cloud.nfs.storageCapacity" "Enter NFS storage capacity (e.g., 1Ti, 500Gi)" "1Ti"
print_success "Configuration collected successfully"