mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
257 lines
11 KiB
Plaintext
257 lines
11 KiB
Plaintext
# DBAL Daemon Environment Configuration
|
|
# Copy this file to .env and customize for your environment
|
|
|
|
# ============================================================================
|
|
# REQUIRED: Schema and Template Paths
|
|
# ============================================================================
|
|
DBAL_SCHEMA_DIR=/app/schemas/entities
|
|
DBAL_TEMPLATE_DIR=/app/templates/sql
|
|
|
|
# ============================================================================
|
|
# Database Configuration
|
|
# ============================================================================
|
|
|
|
# Database adapter type: sqlite, postgres, mysql, mariadb, cockroachdb, mongodb,
|
|
# redis, elasticsearch, cassandra, surrealdb, supabase, prisma
|
|
DBAL_ADAPTER=sqlite
|
|
|
|
# Database connection URL (standard method for all backends)
|
|
DATABASE_URL=:memory:
|
|
|
|
# ────────────────────────────────────────────────────────────────────────────
|
|
# Connection URL Examples for All 13 Backends:
|
|
# ────────────────────────────────────────────────────────────────────────────
|
|
|
|
# SQLite (in-memory)
|
|
# DATABASE_URL=:memory:
|
|
|
|
# SQLite (file-based)
|
|
# DATABASE_URL=/app/data/dbal.db
|
|
|
|
# PostgreSQL
|
|
# DATABASE_URL=postgresql://user:password@localhost:5432/dbal
|
|
|
|
# MySQL
|
|
# DATABASE_URL=mysql://user:password@localhost:3306/dbal
|
|
|
|
# MariaDB (MySQL-compatible)
|
|
# DATABASE_URL=mysql://user:password@localhost:3306/dbal
|
|
|
|
# CockroachDB (PostgreSQL-compatible, distributed SQL)
|
|
# DATABASE_URL=postgresql://root@localhost:26257/dbal?sslmode=disable
|
|
|
|
# MongoDB (NoSQL document store)
|
|
# DATABASE_URL=mongodb://user:password@localhost:27017/dbal?authSource=admin
|
|
|
|
# Redis (in-memory key-value cache)
|
|
# DATABASE_URL=redis://localhost:6379/0
|
|
# DATABASE_URL=redis://:password@localhost:6379/0 # With password
|
|
#
|
|
# EDGE CASE - Redis as Cache Layer:
|
|
# Redis can be used IN CONJUNCTION with other adapters for speed optimization:
|
|
# - Primary adapter: PostgreSQL/MySQL (persistent storage)
|
|
# - Cache adapter: Redis (L1/L2 cache layer)
|
|
# - Pattern: Read-through cache, write-through cache, cache-aside
|
|
# Example Configuration:
|
|
# DBAL_ADAPTER=postgres
|
|
# DATABASE_URL=postgresql://user:password@localhost:5432/dbal
|
|
# DBAL_CACHE_URL=redis://localhost:6379/0?ttl=300&pattern=read-through
|
|
# This provides sub-millisecond reads while maintaining ACID compliance
|
|
|
|
# Elasticsearch (full-text search engine)
|
|
# DATABASE_URL=http://localhost:9200?index=dbal&type=_doc
|
|
# DATABASE_URL=https://user:password@localhost:9200?index=dbal&verify_certs=false
|
|
#
|
|
# EDGE CASE - Elasticsearch as Search Layer:
|
|
# Elasticsearch can be used IN CONJUNCTION with other adapters for full-text search:
|
|
# - Primary adapter: PostgreSQL/MySQL (ACID storage)
|
|
# - Search adapter: Elasticsearch (full-text, analytics, logs)
|
|
# - Pattern: Write to both, search from Elasticsearch, read from primary
|
|
# Example Configuration:
|
|
# DBAL_ADAPTER=postgres
|
|
# DATABASE_URL=postgresql://user:password@localhost:5432/dbal
|
|
# DBAL_SEARCH_URL=http://localhost:9200?index=dbal_search&refresh=true
|
|
# Use cases: Fuzzy search, analytics dashboards, log aggregation, geospatial queries
|
|
|
|
# Cassandra (wide-column store)
|
|
# DATABASE_URL=cassandra://localhost:9042/dbal?consistency=quorum&replication_factor=3
|
|
|
|
# SurrealDB (multi-model: docs, graphs, KV)
|
|
# DATABASE_URL=ws://localhost:8000/rpc?ns=namespace&db=database&auth=root:root
|
|
# DATABASE_URL=http://localhost:8000?ns=namespace&db=database # HTTP mode
|
|
|
|
# Supabase (REST API mode)
|
|
# DATABASE_URL=https://your-project.supabase.co?key=your-anon-or-service-key&mode=rest
|
|
|
|
# Supabase (Direct PostgreSQL mode)
|
|
# DATABASE_URL=postgresql://postgres:password@db.your-project.supabase.co:5432/postgres?mode=postgres
|
|
|
|
# Prisma (ORM with auto-schema generation)
|
|
# DATABASE_URL=postgresql://user:password@localhost:5432/dbal_prisma?schema=public&preview_features=true
|
|
|
|
# ============================================================================
|
|
# Server Configuration
|
|
# ============================================================================
|
|
|
|
# Bind address (0.0.0.0 for all interfaces, 127.0.0.1 for localhost only)
|
|
DBAL_BIND_ADDRESS=0.0.0.0
|
|
|
|
# Port to listen on
|
|
DBAL_PORT=8080
|
|
|
|
# Server mode: development, production
|
|
DBAL_MODE=production
|
|
|
|
# ============================================================================
|
|
# Logging Configuration
|
|
# ============================================================================
|
|
|
|
# Log level: trace, debug, info, warn, error, critical
|
|
DBAL_LOG_LEVEL=info
|
|
|
|
# Log format: json, text
|
|
DBAL_LOG_FORMAT=json
|
|
|
|
# Log file path (empty = stdout only)
|
|
DBAL_LOG_FILE=
|
|
|
|
# ============================================================================
|
|
# Feature Flags
|
|
# ============================================================================
|
|
|
|
# Automatically create tables from schemas on startup
|
|
DBAL_AUTO_CREATE_TABLES=true
|
|
|
|
# Enable Prometheus metrics endpoint
|
|
DBAL_ENABLE_METRICS=true
|
|
|
|
# Enable /health endpoint
|
|
DBAL_ENABLE_HEALTH_CHECK=true
|
|
|
|
# ============================================================================
|
|
# Connection Pool Settings
|
|
# ============================================================================
|
|
|
|
# Minimum number of connections to keep in pool
|
|
DBAL_POOL_MIN_SIZE=2
|
|
|
|
# Maximum number of connections in pool
|
|
DBAL_POOL_MAX_SIZE=10
|
|
|
|
# Idle connection timeout in seconds
|
|
DBAL_POOL_IDLE_TIMEOUT_SECONDS=300
|
|
|
|
# ============================================================================
|
|
# Security
|
|
# ============================================================================
|
|
|
|
# Bearer token for /admin/* endpoints (GET/POST config, adapters, test-connection)
|
|
# Admin endpoints return 403 when no token is configured (secure by default)
|
|
DBAL_ADMIN_TOKEN=069e6487a710300381cd52120eab95d56d7f53beee21479cbeba9128217cbea9
|
|
|
|
# Allowed CORS origin (only this origin can make cross-origin requests)
|
|
# Defaults to http://localhost:3000 if not set
|
|
DBAL_CORS_ORIGIN=http://localhost:3000
|
|
|
|
# ============================================================================
|
|
# Request Limits
|
|
# ============================================================================
|
|
|
|
# Maximum request body size in MB
|
|
DBAL_MAX_REQUEST_SIZE_MB=10
|
|
|
|
# Request timeout in seconds
|
|
DBAL_REQUEST_TIMEOUT_SECONDS=30
|
|
|
|
# ============================================================================
|
|
# Blob Storage Configuration
|
|
# ============================================================================
|
|
|
|
# Blob storage backend: memory, filesystem, s3
|
|
# - memory: In-memory (fast, non-persistent, good for testing/development)
|
|
# - filesystem: Local disk (content-addressed, persistent)
|
|
# - s3: S3-compatible API (AWS S3, MinIO, Garage, SeaweedFS, etc.)
|
|
DBAL_BLOB_BACKEND=memory
|
|
|
|
# ────────────────────────────────────────────────────────────────────────────
|
|
# Filesystem backend settings
|
|
# ────────────────────────────────────────────────────────────────────────────
|
|
# Root directory for blob storage (created automatically if it does not exist)
|
|
# DBAL_BLOB_DIR=/data/blobs
|
|
|
|
# ────────────────────────────────────────────────────────────────────────────
|
|
# S3-compatible backend settings
|
|
# ────────────────────────────────────────────────────────────────────────────
|
|
# Works with AWS S3, MinIO, Garage, SeaweedFS, Ceph RGW, and any
|
|
# service implementing the S3 API with AWS Signature V4 authentication.
|
|
#
|
|
# DBAL_BLOB_URL=http://localhost:9000
|
|
# DBAL_BLOB_BUCKET=dbal-storage
|
|
# DBAL_BLOB_REGION=us-east-1
|
|
# DBAL_BLOB_ACCESS_KEY=minioadmin
|
|
# DBAL_BLOB_SECRET_KEY=minioadmin
|
|
# DBAL_BLOB_PATH_STYLE=true
|
|
#
|
|
# ── MinIO (local development) ──────────────────────────────────────────────
|
|
# docker run -d --name minio \
|
|
# -p 9000:9000 -p 9001:9001 \
|
|
# -e MINIO_ROOT_USER=minioadmin \
|
|
# -e MINIO_ROOT_PASSWORD=minioadmin \
|
|
# minio/minio server /data --console-address ":9001"
|
|
#
|
|
# Then set:
|
|
# DBAL_BLOB_BACKEND=s3
|
|
# DBAL_BLOB_URL=http://localhost:9000
|
|
# DBAL_BLOB_BUCKET=dbal-storage
|
|
# DBAL_BLOB_ACCESS_KEY=minioadmin
|
|
# DBAL_BLOB_SECRET_KEY=minioadmin
|
|
# DBAL_BLOB_PATH_STYLE=true
|
|
#
|
|
# ── AWS S3 (production) ───────────────────────────────────────────────────
|
|
# Set:
|
|
# DBAL_BLOB_BACKEND=s3
|
|
# DBAL_BLOB_URL=https://s3.amazonaws.com
|
|
# DBAL_BLOB_BUCKET=my-production-bucket
|
|
# DBAL_BLOB_REGION=us-east-1
|
|
# DBAL_BLOB_ACCESS_KEY=AKIA...
|
|
# DBAL_BLOB_SECRET_KEY=wJal...
|
|
# DBAL_BLOB_PATH_STYLE=false
|
|
|
|
# ============================================================================
|
|
# Seed Data Configuration
|
|
# ============================================================================
|
|
|
|
# Directory containing YAML seed files for database population
|
|
# Files are loaded in dependency order (users → credentials → workspaces → ...)
|
|
# Defaults to auto-detection: checks DBAL_SEED_DIR, then relative paths
|
|
# DBAL_SEED_DIR=/app/dbal/shared/seeds/database
|
|
#
|
|
# Load seed data via:
|
|
# curl -X POST http://localhost:8080/admin/seed \
|
|
# -H "Authorization: Bearer $DBAL_ADMIN_TOKEN" \
|
|
# -H "Content-Type: application/json" \
|
|
# -d '{"force": false}'
|
|
#
|
|
# Options:
|
|
# force=true — ignore skipIfExists metadata, re-insert all records
|
|
# seed_dir=path — override DBAL_SEED_DIR for this request
|
|
|
|
# ============================================================================
|
|
# Advanced Configuration
|
|
# ============================================================================
|
|
|
|
# Rate limiting (requests per 60-second window, per client IP / X-Forwarded-For)
|
|
# Increase DBAL_READ_RATE_LIMIT if multiple users share the same upstream IP (e.g. behind nginx)
|
|
DBAL_READ_RATE_LIMIT=1000
|
|
DBAL_MUTATION_RATE_LIMIT=50
|
|
DBAL_ADMIN_RATE_LIMIT=10
|
|
|
|
# Enable SQL query logging (debug mode)
|
|
DBAL_LOG_SQL_QUERIES=false
|
|
|
|
# Enable performance metrics
|
|
DBAL_LOG_PERFORMANCE=false
|
|
|
|
# Cache TTL in seconds for entity metadata
|
|
DBAL_METADATA_CACHE_TTL=3600
|