From 55b052256a23d1a06533e805e78121ab59d74f7b Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Wed, 25 Jun 2025 12:35:12 -0700 Subject: [PATCH] Refactor env.sh for wild-setup. --- env.sh | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/env.sh b/env.sh index 937351a..5e3186a 100644 --- a/env.sh +++ b/env.sh @@ -2,10 +2,10 @@ # Set the WC_HOME environment variable to this script's directory. # This variable is used consistently across the Wild Config scripts. -export WC_HOME="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" +export WC_ROOT="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" # Add bin to path first so wild-config is available -export PATH="$WC_HOME/bin:$PATH" +export PATH="$WC_ROOT/bin:$PATH" # Install kubectl if ! command -v kubectl &> /dev/null; then @@ -29,21 +29,3 @@ if ! command -v gomplate &> /dev/null; then echo "Visit: https://docs.gomplate.ca/installing/" exit 1 fi - -KUBECONFIG=~/.kube/config -export KUBECONFIG - -# Use cluster name as both talos and kubectl context name -CLUSTER_NAME=$(wild-config cluster.name) -if [ -z "${CLUSTER_NAME}" ] || [ "${CLUSTER_NAME}" = "null" ]; then - echo "Error: cluster.name not set in config.yaml" - exit 1 -fi - -# Only try to use the kubectl context if it exists -if kubectl config get-contexts "${CLUSTER_NAME}" >/dev/null 2>&1; then - kubectl config use-context "${CLUSTER_NAME}" - echo "Using Kubernetes context: ${CLUSTER_NAME}" -# else -# echo "Kubernetes context '${CLUSTER_NAME}' not found, skipping context switch" -fi