Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions core/start-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ else
echo -e "${GREEN}No .env file was read.${ENDCOLOR}"
fi

# Define default paths of the apps
declare -A default_app_paths
default_app_paths["engine"]="../../OpenConext-engineblock"
default_app_paths["profile"]="../../OpenConext-profile"
default_app_paths["sbs"]="../../SBS"
default_app_paths["spdashboard"]="../../sp-dashboard/"
default_app_paths["userlifecycle"]="../../OpenConext-user-lifecycle"


# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand Down Expand Up @@ -113,11 +122,16 @@ while [[ $# -gt 0 ]]; do
path=$(echo "$arg" | cut -d ':' -f 2)

# Basic validation
if [[ -z "$app" ]] || [[ -z "$path" ]]; then
if [[ -z "$app" ]]; then
echo -e "${RED}Invalid argument format: '$arg'. Expected <app>:<path>${ENDCOLOR}"
exit 1
fi

if [[ -z "$path" || "$path" == "$app" ]]; then
path=${default_app_paths[$app]}
echo "Using default path '$path' for app '$app'"
fi

# Check if the app is a valid subdirectory in the APP_DIR directory
if ! [[ $app =~ ^[a-zA-Z0-9_-]+$ ]]; then
echo -e "${RED}The specified app '${app}' is not a valid name for an app.${ENDCOLOR}\n";
Expand All @@ -129,13 +143,19 @@ while [[ $# -gt 0 ]]; do
exit 1;
fi

# Replace "~/" with the user's home directory
path=${path/#\~/$HOME}
if [[ -z "$path" || "$path" == "$app" ]]; then
path=${default_app_paths[$app]}
echo "Using default path '$path' for app '$app'"
fi

# Canonicalize path
orig_path=path
path=$( readlink -f "$path" )

# Test if the specified path(s) exist.
if [ ! -d "${path}" ]; then
if [[ -z "$path" || ! -d "${path}" ]]; then
echo -e "${RED}The specified path for app '${app}' is not a directory.";
echo -e "Please verify that the '${path}' directory exists.${ENDCOLOR}\n";
echo -e "Please verify that the '${orig_path}' directory exists.${ENDCOLOR}\n";
exit 1;
fi

Expand Down
18 changes: 16 additions & 2 deletions stepup/start-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ else
echo -e "${GREEN}No .env file was read.${ENDCOLOR}"
fi

# Define default paths of the apps
declare -A default_app_paths
default_app_paths["webauthn"]="../../Stepup-Webauthn"
default_app_paths["middleware"]="../../Stepup-Middleware"
default_app_paths["gateway"]="../../Stepup-Gateway"
default_app_paths["ra"]="../../Stepup-RA"
default_app_paths["tiqr"]="../../Stepup-tiqr"
default_app_paths["azuremfa"]="../../Stepup-Azure-MFA"

# Get script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand Down Expand Up @@ -153,8 +162,13 @@ while [[ $# -gt 0 ]]; do
exit 1;
fi

# Replace "~/" with the user's home directory
path=${path/#\~/$HOME}
if [[ -z "$path" || "$path" == "$app" ]]; then
path=${default_app_paths[$app]}
echo "Using default path '$path' for app '$app'"
fi

# Canonicalize path
path=$(readlink -f "$path")

# Test if the specified path(s) exist.
if [ ! -d "${path}" ]; then
Expand Down
Loading