Skip to content

Enterprise Configuration

This page is a complete reference for all enterprise-specific CLI flags and environment variables. For general (OSS) configuration, see the Configuration page.

Authentication

FlagEnvironment VariableDefaultDescription
--enable-authMADHYAMAS_ENABLE_AUTHfalseEnable authentication middleware
--jwt-secretMADHYAMAS_JWT_SECRETdev secretHMAC-SHA256 secret for JWT signing
--jwt-expiration-secsMADHYAMAS_JWT_EXPIRATION_SECS3600Access token lifetime (seconds)
--refresh-interval-secsMADHYAMAS_REFRESH_INTERVAL_SECS300Web UI token refresh interval
--api-key-headerMADHYAMAS_API_KEY_HEADERX-API-KeyHeader name for API key auth
--auth-modeMADHYAMAS_AUTH_MODElocalAuth mode: local, oidc, header, ldap, saml
--proxy-authMADHYAMAS_PROXY_AUTHfalseRequire auth for proxy connections

OIDC

FlagEnvironment VariableDefaultDescription
--oidc-issuerMADHYAMAS_OIDC_ISSUEROIDC issuer URL
--oidc-client-idMADHYAMAS_OIDC_CLIENT_IDOIDC client ID
--oidc-client-secretMADHYAMAS_OIDC_CLIENT_SECRETOIDC client secret
--oidc-redirect-uriMADHYAMAS_OIDC_REDIRECT_URIOIDC callback URL

LDAP

FlagEnvironment VariableDefaultDescription
--ldap-urlMADHYAMAS_LDAP_URLLDAP server URL
--ldap-base-dnMADHYAMAS_LDAP_BASE_DNBase DN for user search
--ldap-bind-dnMADHYAMAS_LDAP_BIND_DNService account DN
--ldap-bind-passwordMADHYAMAS_LDAP_BIND_PASSWORDService account password
--ldap-user-filterMADHYAMAS_LDAP_USER_FILTERUser search filter (use {username})

Header-based Auth

FlagEnvironment VariableDefaultDescription
--auth-headerMADHYAMAS_AUTH_HEADERX-Forwarded-UserHeader containing username
--auth-header-roleMADHYAMAS_AUTH_HEADER_ROLEX-Forwarded-RoleHeader containing role

Database

FlagEnvironment VariableDefaultDescription
--database-urlMADHYAMAS_DATABASE_URLSQLitePostgreSQL connection URL
--database-read-urlMADHYAMAS_DATABASE_READ_URLRead replica URL (optional)
--database-url-fileMADHYAMAS_DATABASE_URL_FILEPath to file containing DB URL (for secret managers)

Secret managers

Use --database-url-file with Kubernetes Secrets, AWS Secrets Manager, or HashiCorp Vault to avoid exposing the database URL in environment variables.

PostgreSQL URL Format

postgres://username:password@host:port/database?sslmode=require

Examples:

bash
# Local PostgreSQL
--database-url postgres://madhyamas:password@localhost:5432/madhyamas

# With TLS
--database-url "postgres://madhyamas:password@db.internal:5432/madhyamas?sslmode=require"

# Read replica
--database-url postgres://primary.internal:5432/madhyamas \
--database-read-url postgres://replica.internal:5432/madhyamas

Redis

FlagEnvironment VariableDefaultDescription
--redis-urlMADHYAMAS_REDIS_URLRedis URL for multi-instance pub/sub
--redis-ca-certMADHYAMAS_REDIS_CA_CERTsystem CAPath to CA cert for Redis TLS verification

Redis URL Format

redis://host:port          # Plain TCP
rediss://host:port         # TLS
redis://:password@host:port  # With password

License

FlagEnvironment VariableDefaultDescription
--license-fileMADHYAMAS_LICENSE_FILEPath to Ed25519-signed license file
--instance-idMADHYAMAS_INSTANCE_IDauto-generatedUnique instance ID for license enforcement

Admin Bootstrap

FlagEnvironment VariableDefaultDescription
--admin-usernameMADHYAMAS_ADMIN_USERNAMEadminBootstrap admin username
--admin-passwordMADHYAMAS_ADMIN_PASSWORDrandomBootstrap admin password

TLS / CA Certificate

FlagEnvironment VariableDefaultDescription
--ca-cert-fileMADHYAMAS_CA_CERT_FILEgeneratedPath to shared CA certificate
--ca-key-fileMADHYAMAS_CA_KEY_FILEgeneratedPath to shared CA private key

Load Balancer

FlagEnvironment VariableDefaultDescription
--base-pathMADHYAMAS_BASE_PATH/Base path for context-path routing

CLI / MCP Auth

FlagEnvironment VariableDefaultDescription
--api-keyMADHYAMAS_API_KEYAPI key for CLI/MCP authentication
--tokenMADHYAMAS_TOKENJWT token for CLI/MCP authentication

Configuration Import/Export

Export

bash
curl -H "Authorization: Bearer <token>" \
  http://localhost:3001/api/config/export > config-backup.json

Import

bash
curl -X POST http://localhost:3001/api/config/import \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d @config-backup.json

The export includes all intercept rules (mocks, rewrites, breakpoints, throttle, block list), focus hosts, capture settings, and auto-save configuration. It does not include users, API keys, audit logs, or license information.

Production Checklist

Security

  • [ ] Change JWT secret — Set --jwt-secret to a strong, random value (32+ characters)
  • [ ] Set admin password — Set --admin-password to a strong password
  • [ ] Enable auth — Set --enable-auth true
  • [ ] Install license — Set --license-file to your license
  • [ ] Enable TLS — Use sslmode=require in the database URL
  • [ ] Redis TLS — Use rediss:// for Redis connections
  • [ ] Restrict access — Use --allowed-ip to limit proxy access
  • [ ] Proxy auth — Set --proxy-auth if the proxy is exposed

Database

  • [ ] PostgreSQL 16+ — Use a supported version
  • [ ] Connection pooling — Use PgBouncer for high-traffic deployments
  • [ ] Backups — Set up regular PostgreSQL backups
  • [ ] Read replica — Configure --database-read-url for query offloading

Multi-Instance

  • [ ] Shared JWT secret — All instances must use the same --jwt-secret
  • [ ] Shared CA — All instances must use the same --ca-cert-file volume
  • [ ] Unique instance IDs — Each instance must have a unique --instance-id
  • [ ] Health checks — Configure load balancer health probes to /health
  • [ ] WebSocket stickiness — Configure ip_hash or session affinity for WebSocket

Monitoring

  • [ ] Health check monitoring — Monitor /health and /api/health/detailed
  • [ ] Log aggregation — Forward logs to your log management system
  • [ ] Alerting — Set up alerts for unhealthy instances
  • [ ] Audit log retention — Configure audit log retention policy

Complete Example

bash
madhyamas \
  --database-url "postgres://madhyamas:secure-password@db.internal:5432/madhyamas?sslmode=require" \
  --database-read-url "postgres://madhyamas:secure-password@replica.internal:5432/madhyamas?sslmode=require" \
  --redis-url "rediss://:redis-password@redis.internal:6379" \
  --enable-auth \
  --jwt-secret "your-32-char-production-secret" \
  --admin-username admin \
  --admin-password "your-secure-admin-password" \
  --license-file /secrets/license.json \
  --ca-cert-file /certs/ca-cert.pem \
  --ca-key-file /certs/ca-key.pem \
  --instance-id madhyamas-prod-1 \
  --proxy-auth \
  --allowed-ip 10.0.0.0/8 \
  --api-port 3001 \
  --proxy-port 8888

See Also

Released under the MIT OR Apache-2.0 License.