From 4a84fd24e519bcb5b130ae061be25f0ed0c2b443 Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Sun, 5 Mar 2023 11:45:27 -0500 Subject: [PATCH] Refactor project env --- deployment/cluster_env.sh | 21 --------------------- deployment/project_env.sh | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 21 deletions(-) create mode 100755 deployment/project_env.sh diff --git a/deployment/cluster_env.sh b/deployment/cluster_env.sh index 47f5af8..8309d50 100755 --- a/deployment/cluster_env.sh +++ b/deployment/cluster_env.sh @@ -40,24 +40,3 @@ if [ ! -f "$CLUSTER_DEFINITION" ]; then fi source "$CLUSTER_DEFINITION" - -# source project defition. -# Now let's load the project definition. -PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN" -export PROJECT_NAME="$PROJECT_NAME" -PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME" -PROJECT_DEFINITION_PATH="$PROJECT_PATH/project_definition" - -if [ ! -f "$PROJECT_DEFINITION_PATH" ]; then - echo "ERROR: 'project_definition' not found $PROJECT_DEFINITION_PATH not found." - exit 1 -fi - -source "$PROJECT_DEFINITION_PATH" -export PRIMARY_SITE_DEFINITION_PATH="$SITES_PATH/$PRIMARY_DOMAIN/site_definition" -source "$PRIMARY_SITE_DEFINITION_PATH" - -if [ -z "$PRIMARY_DOMAIN" ]; then - echo "ERROR: The PRIMARY_DOMAIN is not specified. Check your cluster definition." - exit 1 -fi diff --git a/deployment/project_env.sh b/deployment/project_env.sh new file mode 100755 index 0000000..62446a3 --- /dev/null +++ b/deployment/project_env.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -eu +cd "$(dirname "$0")" + +# source project defition. +# Now let's load the project definition. +PROJECT_NAME="$PROJECT_PREFIX-$BITCOIN_CHAIN" +export PROJECT_NAME="$PROJECT_NAME" +PROJECT_PATH="$PROJECTS_DIR/$PROJECT_NAME" +PROJECT_DEFINITION_PATH="$PROJECT_PATH/project_definition" + +if [ ! -f "$PROJECT_DEFINITION_PATH" ]; then + echo "ERROR: 'project_definition' not found $PROJECT_DEFINITION_PATH not found." + exit 1 +fi + +source "$PROJECT_DEFINITION_PATH" +export PRIMARY_SITE_DEFINITION_PATH="$SITES_PATH/$PRIMARY_DOMAIN/site_definition" +source "$PRIMARY_SITE_DEFINITION_PATH" + +if [ -z "$PRIMARY_DOMAIN" ]; then + echo "ERROR: The PRIMARY_DOMAIN is not specified. Check your cluster definition." + exit 1 +fi