Skip to content

Application Configuration

The backend platform uses a layered configuration system. Understanding these layers is critical — misconfiguration is the most common cause of deployment failures.

Configuration Layers (Priority Order)

1. Runtime flags      (-e SPRING_PROFILES_ACTIVE=test)       ← highest priority
2. Environment file   (--env-file /opt/slaunchx/.../test.env)
3. Profile YAML       (application-test.yml in JAR)
4. Base YAML          (application.yml in JAR)                ← lowest priority

Higher layers override lower layers. You should never modify YAML files in the JAR — use env files and runtime flags instead.

Spring Profiles

ProfilePurposeWhen to Use
devLocal developmentIDE / localhost
testIntegration testingCI/CD test stage
alphaPre-production stagingStaging environment
productProductionLive production

Set the active profile at container start:

bash
-e SPRING_PROFILES_ACTIVE=test

Environment Variable Reference

Database (MySQL)

VariableExampleNotes
DB_HOSTslaunchx-mysql-testUse Docker container name, not IP
DB_PORT3306Internal Docker port, not the host-mapped port
DB_NAMEslaunchxMain database name
DB_USERNAMEslaunchxApplication user
DB_PASSWORD(secret)

Known Issue: Variable Naming

The dev profile uses DB_USER and RABBITMQ_USER, while other profiles use DB_USERNAME and RABBITMQ_USERNAME. Always check which name your target profile expects. Using the wrong name causes a silent fallback to default credentials.

Redis

VariableExampleNotes
REDIS_HOSTslaunchx-redis-testContainer name
REDIS_PORT6379Internal port
REDIS_DATABASE0Database index
REDIS_PASSWORD(secret)

RabbitMQ

VariableExampleNotes
RABBITMQ_HOSTslaunchx-rabbitmq-testContainer name
RABBITMQ_PORT5672AMQP port
RABBITMQ_USERNAMEslaunchxSee naming warning above
RABBITMQ_PASSWORD(secret)

Security & Encryption

VariableExampleNotes
SLAUNCHX_SECURITY_ENCRYPTION_MASTER_KEYS_K1(base64)AES-256 key, 32 bytes base64-encoded
SLAUNCHX_SECURITY_ENCRYPTION_ACTIVE_KEY_VERSIONK1Which master key is active
SLAUNCHX_SECURITY_ENCRYPTION_HKDF_SALT(hex)HKDF salt for key derivation
OTP_ENCRYPTION_KEY(base64)32-byte key for OTP secret encryption

Encryption Keys

These keys protect user data at rest. Losing the master key means losing access to all encrypted data. Back up these values securely and never store them in plain text in version control.

Object Storage (MinIO)

VariableExampleNotes
MINIO_ENDPOINThttp://slaunchx-minio-test:9000Full URL with protocol
MINIO_ACCESS_KEY(secret)
MINIO_SECRET_KEY(secret)

Bootstrap (First Deployment Only)

VariableExampleNotes
SYSTEM_BOOTSTRAP_CONFIG/config/bootstrap.jsonPath to institution init config
SLAUNCHX_BOOTSTRAP_ADMIN_PASSWORD(secret)Initial SYSTEM admin password

These are only needed on the very first startup to create the initial institution, portal configuration, and admin account.

External Integrations (Optional)

VariableServiceNotes
TURNSTILE_SECRET_KEYCloudflare TurnstileBot protection
STRIPE_API_KEYStripePayment processing
TRON_RPC_ENDPOINTTRONBlockchain access
SOLANA_RPC_ENDPOINTSolanaBlockchain access

JVM Configuration

Set JVM options via the JAVA_OPTS environment variable:

bash
-e JAVA_OPTS="-Xms512m -Xmx1024m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
EnvironmentRecommended XmsRecommended Xmx
test256m512m
alpha512m1024m
product1024m2048m

The platform uses JDK 21 virtual threads (spring.threads.virtual.enabled=true), so thread pool sizing is less critical than in traditional deployments.

Preparing the Env File

Create one env file per module per environment. Example for app-prometheus in test:

bash
cat > /opt/slaunchx/config/app-prometheus/test.env << 'EOF'
# Database
DB_HOST=slaunchx-mysql-test
DB_PORT=3306
DB_NAME=slaunchx
DB_USERNAME=slaunchx
DB_PASSWORD=your-db-password

# Redis
REDIS_HOST=slaunchx-redis-test
REDIS_PORT=6379
REDIS_DATABASE=0
REDIS_PASSWORD=your-redis-password

# RabbitMQ
RABBITMQ_HOST=slaunchx-rabbitmq-test
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=slaunchx
RABBITMQ_PASSWORD=your-rabbitmq-password

# MinIO
MINIO_ENDPOINT=http://slaunchx-minio-test:9000
MINIO_ACCESS_KEY=your-access-key
MINIO_SECRET_KEY=your-secret-key

# Security
SLAUNCHX_SECURITY_ENCRYPTION_MASTER_KEYS_K1=your-base64-master-key
SLAUNCHX_SECURITY_ENCRYPTION_ACTIVE_KEY_VERSION=K1
SLAUNCHX_SECURITY_ENCRYPTION_HKDF_SALT=your-hkdf-salt
OTP_ENCRYPTION_KEY=your-base64-otp-key

# JVM
JAVA_OPTS=-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200
EOF

# Secure the file
chmod 600 /opt/slaunchx/config/app-prometheus/test.env

Configuration Checklist

  • [ ] Active profile is set (SPRING_PROFILES_ACTIVE)
  • [ ] All database connection variables filled
  • [ ] All Redis connection variables filled
  • [ ] All RabbitMQ connection variables filled
  • [ ] MinIO endpoint and credentials set
  • [ ] Encryption keys generated and stored securely
  • [ ] Env file permissions restricted (chmod 600)
  • [ ] For first deployment: bootstrap config prepared

Internal Handbook