forked from trent_larson/crowd-funder-for-time-pwa
fix: Change some build instructions to include BUILD_MODE, and other script tweaks
This commit is contained in:
@@ -184,7 +184,7 @@ log_info "Build mode: $BUILD_MODE"
|
||||
log_info "Build type: $BUILD_TYPE"
|
||||
|
||||
# Setup environment for Capacitor build
|
||||
setup_build_env "capacitor"
|
||||
setup_build_env "capacitor" "$BUILD_MODE"
|
||||
|
||||
# Override API servers for Android development
|
||||
if [ "$BUILD_MODE" = "development" ]; then
|
||||
|
||||
@@ -339,7 +339,7 @@ main_electron_build() {
|
||||
fi
|
||||
|
||||
# Setup environment
|
||||
setup_build_env "electron"
|
||||
setup_build_env "electron" "$BUILD_MODE"
|
||||
setup_app_directories
|
||||
load_env_file ".env"
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ log_info "Build mode: $BUILD_MODE"
|
||||
log_info "Build type: $BUILD_TYPE"
|
||||
|
||||
# Setup environment for Capacitor build
|
||||
setup_build_env "capacitor"
|
||||
setup_build_env "capacitor" "$BUILD_MODE"
|
||||
|
||||
# Override API servers for iOS development when custom IP is specified
|
||||
if [ "$BUILD_MODE" = "development" ] && [ -n "$CUSTOM_API_IP" ]; then
|
||||
|
||||
@@ -332,7 +332,7 @@ log_info "Serve build: $SERVE_BUILD"
|
||||
validate_web_environment
|
||||
|
||||
# Setup environment for web build
|
||||
setup_build_env "web"
|
||||
setup_build_env "web" "$BUILD_MODE"
|
||||
|
||||
# Setup application directories
|
||||
setup_app_directories
|
||||
|
||||
@@ -174,9 +174,9 @@ validate_env_vars() {
|
||||
# Function to set environment variables for different build types
|
||||
setup_build_env() {
|
||||
local build_type="$1"
|
||||
local production="${2:-false}"
|
||||
local build_mode="${2:-development}"
|
||||
|
||||
log_info "Setting up environment for $build_type build"
|
||||
log_info "Setting up environment for $build_type build (mode: $build_mode)"
|
||||
|
||||
# Get git hash for versioning
|
||||
local git_hash=$(get_git_hash)
|
||||
@@ -204,19 +204,19 @@ setup_build_env() {
|
||||
esac
|
||||
|
||||
# Set API server environment variables based on build mode
|
||||
if [ "$BUILD_MODE" = "development" ]; then
|
||||
if [ "$build_mode" = "development" ]; then
|
||||
# For Capacitor development, use localhost by default
|
||||
# Android builds will override this in build-android.sh
|
||||
export VITE_DEFAULT_ENDORSER_API_SERVER="http://localhost:3000"
|
||||
export VITE_DEFAULT_PARTNER_API_SERVER="http://localhost:3000"
|
||||
log_debug "Development mode: Using localhost for Endorser and Partner APIs"
|
||||
export VITE_DEFAULT_IMAGE_API_SERVER="https://image-api.timesafari.app"
|
||||
elif [ "$BUILD_MODE" = "test" ]; then
|
||||
elif [ "$build_mode" = "test" ]; then
|
||||
export VITE_DEFAULT_ENDORSER_API_SERVER="https://test-api.endorser.ch"
|
||||
export VITE_DEFAULT_PARTNER_API_SERVER="https://test-partner-api.endorser.ch"
|
||||
log_debug "Test mode: Using test Endorser and Partner APIs"
|
||||
export VITE_DEFAULT_IMAGE_API_SERVER="https://image-api.timesafari.app"
|
||||
elif [ "$BUILD_MODE" = "production" ]; then
|
||||
elif [ "$build_mode" = "production" ]; then
|
||||
export VITE_DEFAULT_ENDORSER_API_SERVER="https://api.endorser.ch"
|
||||
export VITE_DEFAULT_PARTNER_API_SERVER="https://partner-api.endorser.ch"
|
||||
log_debug "Production mode: Using production API servers"
|
||||
|
||||
@@ -17,34 +17,40 @@ parse_args "$@"
|
||||
print_header "Environment Variable Test"
|
||||
log_info "Testing environment variable handling at $(date)"
|
||||
|
||||
# Test 1: Capacitor environment
|
||||
log_info "Test 1: Setting up Capacitor environment..."
|
||||
setup_build_env "capacitor"
|
||||
# Test 1: Capacitor environment (development)
|
||||
log_info "Test 1: Setting up Capacitor environment (development mode)..."
|
||||
setup_build_env "capacitor" "development"
|
||||
print_env_vars "VITE_"
|
||||
echo ""
|
||||
|
||||
# Test 2: Web environment
|
||||
log_info "Test 2: Setting up Web environment..."
|
||||
setup_build_env "web"
|
||||
# Test 2: Web environment (development)
|
||||
log_info "Test 2: Setting up Web environment (development mode)..."
|
||||
setup_build_env "web" "development"
|
||||
print_env_vars "VITE_"
|
||||
echo ""
|
||||
|
||||
# Test 3: Production Capacitor environment
|
||||
log_info "Test 3: Setting up Production Capacitor environment..."
|
||||
setup_build_env "capacitor" "true"
|
||||
# Test 3: Capacitor test environment
|
||||
log_info "Test 3: Setting up Capacitor environment (test mode)..."
|
||||
setup_build_env "capacitor" "test"
|
||||
print_env_vars "VITE_"
|
||||
echo ""
|
||||
|
||||
# Test 4: Application directories
|
||||
log_info "Test 4: Setting up application directories..."
|
||||
# Test 4: Capacitor production environment
|
||||
log_info "Test 4: Setting up Capacitor environment (production mode)..."
|
||||
setup_build_env "capacitor" "production"
|
||||
print_env_vars "VITE_"
|
||||
echo ""
|
||||
|
||||
# Test 5: Application directories
|
||||
log_info "Test 5: Setting up application directories..."
|
||||
setup_app_directories
|
||||
|
||||
# Test 5: Load .env file (if it exists)
|
||||
log_info "Test 5: Loading .env file..."
|
||||
# Test 6: Load .env file (if it exists)
|
||||
log_info "Test 6: Loading .env file..."
|
||||
load_env_file ".env"
|
||||
|
||||
# Test 6: Git hash
|
||||
log_info "Test 6: Getting git hash..."
|
||||
# Test 7: Git hash
|
||||
log_info "Test 7: Getting git hash..."
|
||||
GIT_HASH=$(get_git_hash)
|
||||
log_info "Git hash: $GIT_HASH"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user