Configuration Reference
Configuration Reference¶
This document covers all configuration options for Huitzo platform, SDK, and CLI.
Environment Variables¶
Platform (Backend)¶
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL |
✅ | - | PostgreSQL connection string |
REDIS_URL |
✅ | - | Redis connection string |
SECRET_KEY |
✅ | - | JWT signing key (min 32 chars) |
ENVIRONMENT |
❌ | development |
Environment: development, staging, production |
DEBUG |
❌ | false |
Enable debug mode |
LOG_LEVEL |
❌ | INFO |
Logging level |
CORS_ORIGINS |
❌ | * |
Allowed CORS origins (comma-separated) |
Deployment Mode¶
All deployment modes use the same Docker image. The HUITZO_DEPLOYMENT_MODE parameter activates deployment-specific code modules:
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_DEPLOYMENT_MODE |
❌ | cloud |
Deployment mode: cloud, self_hosted, edge |
HUITZO_DEFAULT_TENANT_ID |
❌ | Auto-generated | Fixed tenant ID for self-hosted/edge mode |
Mode-specific behavior:
| Mode | Active Modules | Description |
|---|---|---|
cloud |
core + cloud | Multi-tenant SaaS with billing |
self_hosted |
core + self_hosted | Single-tenant with license validation |
edge |
core + edge | Offline-capable (Year 3+) |
The codebase is organized into modular directories (core/, cloud/, self_hosted/, edge/) with strict import boundaries. This enables future deployment-specific builds when enterprise requirements demand it.
See Architecture Overview for deployment mode details and Build Architecture for the evolution plan.
Storage Backend¶
PostgreSQL is the single database for all deployments. Simple by design, scalable by architecture.
PostgreSQL and Redis can be: - Containers (as in docker-compose examples) - Cloud-managed services (AWS RDS, Azure Database, ElastiCache, etc.) - On-premises dedicated servers
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL |
✅ | - | PostgreSQL connection string |
REDIS_URL |
✅ | - | Redis connection string |
Connection string formats:
# PostgreSQL
DATABASE_URL=postgresql://user:password@host:5432/database
DATABASE_URL=postgresql://user:password@host:5432/database?sslmode=require
# Redis
REDIS_URL=redis://host:6379/0
REDIS_URL=redis://:password@host:6379/0
REDIS_URL=rediss://:password@host:6379/0 # TLS
See Self-Hosting Guide for cloud provider examples and Storage Backends for backend protocol details.
File Storage¶
File uploads and pack output files use a pluggable storage backend. The ctx.files API works identically regardless of backend.
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_FILE_STORAGE_BACKEND |
No | local |
Backend: local, s3, azure, gcs |
HUITZO_FILE_STORAGE_PATH |
No | /app/uploads |
Path for local backend |
HUITZO_FILE_MAX_SIZE_MB |
No | 100 |
Maximum file size |
Backend options:
| Backend | Best For | Configuration |
|---|---|---|
local |
Single-instance, dev/test | Volume mount to /app/uploads |
s3 |
Production, multi-instance | AWS S3, MinIO, DigitalOcean Spaces |
azure |
Azure deployments | Azure Blob Storage |
gcs |
GCP deployments | Google Cloud Storage |
S3-Compatible (AWS S3, MinIO, DigitalOcean Spaces):
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_S3_BUCKET |
Yes | - | Bucket name |
HUITZO_S3_REGION |
Yes* | us-east-1 |
AWS region |
HUITZO_S3_ENDPOINT |
No | AWS default | Custom endpoint (MinIO, Spaces) |
HUITZO_S3_ACCESS_KEY_ID |
Yes | - | Access key |
HUITZO_S3_SECRET_ACCESS_KEY |
Yes | - | Secret key |
HUITZO_S3_USE_SSL |
No | true |
Use HTTPS |
HUITZO_S3_PATH_STYLE |
No | false |
Path-style URLs (for MinIO) |
Azure Blob Storage:
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_AZURE_STORAGE_ACCOUNT |
Yes | - | Storage account name |
HUITZO_AZURE_STORAGE_KEY |
Yes* | - | Storage account key |
HUITZO_AZURE_CONTAINER |
Yes | - | Container name |
HUITZO_AZURE_USE_MANAGED_IDENTITY |
No | false |
Use managed identity |
Google Cloud Storage:
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_GCS_BUCKET |
Yes | - | Bucket name |
HUITZO_GCS_PROJECT |
Yes | - | GCP project ID |
HUITZO_GCS_CREDENTIALS_FILE |
No* | - | Service account JSON path |
See File Storage Backends for detailed configuration examples and migration guide.
HTTP Security¶
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_HTTP_TIMEOUT |
No | 60 |
Default timeout for HTTP requests (seconds) |
HUITZO_HTTP_MAX_REDIRECTS |
No | 5 |
Maximum redirects to follow |
HUITZO_HTTP_VERIFY_SSL |
No | true |
Verify SSL certificates |
HUITZO_HTTP_GLOBAL_ALLOWED_DOMAINS |
No | - | Global domain allowlist (comma-separated) |
Self-Hosted: Global Domain Override
For self-hosted deployments, administrators can set a global domain allowlist:
# Allow specific domains for all packs (comma-separated)
HUITZO_HTTP_GLOBAL_ALLOWED_DOMAINS=api.internal.corp,*.partner.com
Behavior:
- Pack-level allowed_domains are always enforced
- Global allowlist adds additional trusted domains
- If a pack declares no domains and global is empty, all external HTTP is blocked
Authentication¶
| Variable | Required | Default | Description |
|---|---|---|---|
JWT_ALGORITHM |
❌ | HS256 |
JWT algorithm |
JWT_ACCESS_TOKEN_EXPIRE_MINUTES |
❌ | 30 |
Access token TTL |
JWT_REFRESH_TOKEN_EXPIRE_DAYS |
❌ | 7 |
Refresh token TTL |
Services¶
| Variable | Required | Default | Description |
|---|---|---|---|
OPENAI_API_KEY |
❌ | - | OpenAI API key for LLM service |
ANTHROPIC_API_KEY |
❌ | - | Anthropic API key for Claude models |
SENDGRID_API_KEY |
❌ | - | SendGrid API key for email |
TELEGRAM_BOT_TOKEN |
❌ | - | Telegram bot token |
SMTP_HOST |
❌ | - | SMTP server for email (alternative to SendGrid) |
SMTP_PORT |
❌ | 587 |
SMTP port |
SMTP_USER |
❌ | - | SMTP username |
SMTP_PASSWORD |
❌ | - | SMTP password |
Secrets Management¶
Huitzo uses a three-tier secrets model to manage API keys and credentials with proper access boundaries:
| Tier | Owner | Scope | Access Method |
|---|---|---|---|
| Platform | Admin | All packs | ctx.env.require("OPENAI_API_KEY") |
| Pack | Developer | Single pack | ctx.config.get("setting") |
| User | End User | User + Pack | ctx.secrets.require("USER_API_KEY") |
Platform Secrets (Tier 1) are set via environment variables and available to all packs:
# Platform-level API keys
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
SENDGRID_API_KEY=SG...
User Secrets (Tier 3) are per-user API keys that end users provide for their own external services. They are declared in pack manifests and managed through the Dashboard UI or CLI.
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_SECRETS_ENCRYPTION_KEY |
✅ (non-debug) | none | AES-256-GCM key (64-char hex / 32 bytes) for user secrets and encrypted columns (e.g. users.stripe_customer_id). Backend refuses to boot in non-debug mode without it. |
Security: - All secrets encrypted at rest (AES-256-GCM) - User secrets isolated per user + pack - Secret values never logged - Access audited for compliance
See Secrets Management Reference for complete documentation.
Task Queue (Celery)¶
| Variable | Required | Default | Description |
|---|---|---|---|
CELERY_BROKER_URL |
❌ | ${REDIS_URL} |
Celery broker URL |
CELERY_RESULT_BACKEND |
❌ | ${REDIS_URL} |
Celery result backend |
CELERY_TASK_ALWAYS_EAGER |
❌ | false |
Run tasks synchronously (dev only) |
Global Timeouts¶
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_GLOBAL_TIMEOUT |
❌ | 28800 |
Platform-wide max command timeout (seconds) |
HUITZO_DEFAULT_COMMAND_TIMEOUT |
❌ | 60 |
Default timeout for commands without explicit setting |
HUITZO_MAX_PACK_TIMEOUT |
❌ | 28800 |
Maximum allowed pack-level timeout |
The timeout hierarchy is: Command ≤ Pack ≤ Platform Global. See Commands Reference for details.
Self-Hosted (Licensing)¶
| Variable | Required | Default | Description |
|---|---|---|---|
HUITZO_LICENSE_KEY |
✅* | - | License key for self-hosted deployment |
HUITZO_LICENSE_VALIDATION_URL |
❌ | https://api.keygen.sh |
License validation endpoint |
HUITZO_OFFLINE_GRACE_DAYS |
❌ | 7 |
Offline grace period (days) |
HUITZO_LICENSE_CHECK_INTERVAL |
❌ | 86400 |
Re-validation interval (seconds) |
*Required for self_hosted deployment mode.
See Self-Hosting Guide for deployment instructions.
SDK Configuration¶
Per-Command Configuration¶
Commands can be configured via decorator parameters:
from huitzo_sdk import command
@command(
name="my-command",
namespace="mypack",
version="1.0.0",
timeout=60, # Seconds
retries=3, # Retry attempts
queue="medium", # fast | medium | long
output_format="json", # json | text | markdown
)
async def my_command(args, ctx):
pass
Environment Variables (SDK)¶
| Variable | Default | Description |
|---|---|---|
HUITZO_API_URL |
http://localhost:8000 |
Platform API URL |
HUITZO_API_KEY |
- | API key for authentication |
HUITZO_LOG_LEVEL |
INFO |
SDK log level |
HUITZO_TIMEOUT |
60 |
Default request timeout |
Configuration File¶
SDK can be configured via huitzo.toml in your pack directory:
[sdk]
api_url = "http://localhost:8000"
log_level = "DEBUG"
timeout = 60
[sdk.storage]
default_ttl_days = 90
[sdk.llm]
default_model = "gpt-4o-mini"
max_tokens = 4096
temperature = 0.7
CLI Configuration¶
The CLI loads configuration from multiple sources with the following precedence (highest to lowest):
- Project config (
.huitzo.yamlin project root) - User config (
~/.huitzo/config.yaml) - Environment variables (
HUITZO_*) - Defaults (https://huitzo.ai)
Project Configuration (.huitzo.yaml)¶
Place in your pack's root directory for project-specific settings. This is especially useful for self-hosted/enterprise environments:
# .huitzo.yaml - project-level configuration
# API endpoint (required for self-hosted)
api_url: https://huitzo.acme-internal.com
# Authentication settings
auth:
type: oidc # oidc, api_key, or saml
issuer: https://auth.acme.com # Required for OIDC
client_id: huitzo-cli # Optional, defaults to huitzo-cli
# Development session settings
dev:
port: 8080 # Local proxy port
persist: false # Keep sandbox after Ctrl+C
watch: true # Auto-upload on file changes
log_level: debug # Logging level
docs_server: true # Enable local docs server
docs_port: 8124 # Docs server port
docs_update: true # Auto-update docs on startup
User Configuration (~/.huitzo/config.yaml)¶
User-wide defaults that apply to all projects:
# ~/.huitzo/config.yaml
# Default API endpoint
api_url: https://huitzo.ai
# Default organization scope for publishing
default_scope: "@myorg"
# Development preferences
dev:
port: 9000
log_level: info
docs_server: true # Enable local docs server
docs_port: 8124 # Docs server port
# Profiles for multiple environments
profiles:
production:
api_url: https://huitzo.ai
staging:
api_url: https://staging.huitzo.com
enterprise:
api_url: https://huitzo.acme.com
Using Profiles¶
# Use default profile
huitzo pack list
# Use specific profile
huitzo --profile production pack list
# Set via environment
export HUITZO_PROFILE=production
huitzo pack list
Environment Variables (CLI)¶
| Variable | Default | Description |
|---|---|---|
HUITZO_API_URL |
https://huitzo.ai |
API endpoint |
HUITZO_API_KEY |
- | API key for authentication |
HUITZO_PROFILE |
default |
Active profile name |
HUITZO_CONFIG_PATH |
~/.huitzo/config.yaml |
User config file path |
HUITZO_LOG_LEVEL |
info |
CLI logging level |
Self-Hosted Configuration¶
For self-hosted/enterprise deployments, create .huitzo.yaml in your project:
# .huitzo.yaml for self-hosted
api_url: https://huitzo.acme-internal.com
auth:
type: api_key
# Key is read from environment or keychain
Then authenticate:
# CLI reads .huitzo.yaml automatically
huitzo login
# Or explicitly specify config
huitzo login --config .huitzo.yaml
OIDC Authentication (Enterprise)¶
For enterprise SSO with OIDC:
# .huitzo.yaml
api_url: https://huitzo.acme-internal.com
auth:
type: oidc
issuer: https://auth.acme.com
client_id: huitzo-cli
# Optional: scope, audience
The CLI opens your browser for SSO authentication and stores the resulting token securely.
SAML Authentication (Enterprise)¶
For SAML-based SSO:
# .huitzo.yaml
api_url: https://huitzo.acme-internal.com
auth:
type: saml
idp_url: https://idp.acme.com/saml
Configuration Precedence Example¶
Given these configurations:
# ~/.huitzo/config.yaml (user)
api_url: https://huitzo.ai
dev:
port: 9000
# .huitzo.yaml (project)
api_url: https://huitzo.acme.com
dev:
persist: true
And environment:
export HUITZO_LOG_LEVEL=debug
The effective configuration would be:
- api_url: https://huitzo.acme.com (from project)
- dev.port: 9000 (from user)
- dev.persist: true (from project)
- log_level: debug (from environment)
Database Configuration¶
PostgreSQL¶
Connection string format:
postgresql://user:password@host:port/database
Example:
DATABASE_URL=postgresql://huitzo:password@localhost:5432/huitzo
Connection Pool Settings¶
| Variable | Default | Description |
|---|---|---|
DATABASE_POOL_SIZE |
5 |
Connection pool size |
DATABASE_MAX_OVERFLOW |
10 |
Max overflow connections |
DATABASE_POOL_TIMEOUT |
30 |
Pool timeout (seconds) |
DATABASE_POOL_RECYCLE |
1800 |
Recycle connections (seconds) |
Row-Level Security¶
RLS is automatically enabled. Tenant isolation is enforced via:
-- Automatic policy on all tables with tenant_id
CREATE POLICY tenant_isolation ON tablename
USING (tenant_id = current_setting('app.current_tenant')::uuid);
Redis Configuration¶
Connection string format:
redis://[:password@]host:port/db
Examples:
# Local, no password
REDIS_URL=redis://localhost:6379/0
# With password
REDIS_URL=redis://:mypassword@localhost:6379/0
# TLS
REDIS_URL=rediss://user:pass@host:6379/0
Redis Settings¶
| Variable | Default | Description |
|---|---|---|
REDIS_MAX_CONNECTIONS |
10 |
Max connection pool size |
REDIS_SOCKET_TIMEOUT |
5 |
Socket timeout (seconds) |
REDIS_RETRY_ON_TIMEOUT |
true |
Retry on timeout |
Database Migrations¶
Huitzo uses Alembic for database schema migrations. Migrations track changes to PostgreSQL schema over time and allow safe upgrades and rollbacks.
Migration Commands¶
# Apply all pending migrations
huitzo db migrate
# Show current migration status
huitzo db status
# Create a new migration (development)
huitzo db revision --message "Add user preferences table"
# Rollback last migration
huitzo db downgrade -1
# Rollback to specific revision
huitzo db downgrade abc123
# Show migration history
huitzo db history
Migration File Structure¶
Migrations are stored in backend/migrations/versions/:
backend/
├── migrations/
│ ├── env.py # Alembic environment config
│ ├── script.py.mako # Migration template
│ └── versions/
│ ├── 001_initial_schema.py
│ ├── 002_add_pack_registry.py
│ └── 003_add_user_preferences.py
Example Migration¶
# migrations/versions/003_add_user_preferences.py
"""Add user preferences table
Revision ID: 003_preferences
Revises: 002_pack_registry
Create Date: 2026-01-22 10:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import JSONB
revision = '003_preferences'
down_revision = '002_pack_registry'
def upgrade():
op.create_table(
'user_preferences',
sa.Column('id', sa.UUID(), primary_key=True),
sa.Column('user_id', sa.UUID(), sa.ForeignKey('users.id'), nullable=False),
sa.Column('tenant_id', sa.UUID(), sa.ForeignKey('tenants.id'), nullable=False),
sa.Column('preferences', JSONB, nullable=False, server_default='{}'),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.func.now()),
sa.Column('updated_at', sa.DateTime(timezone=True), onupdate=sa.func.now()),
)
op.create_index('ix_user_preferences_user_id', 'user_preferences', ['user_id'])
# Enable RLS
op.execute('ALTER TABLE user_preferences ENABLE ROW LEVEL SECURITY')
op.execute('''
CREATE POLICY tenant_isolation ON user_preferences
USING (tenant_id = current_setting('app.tenant_id')::uuid)
''')
def downgrade():
op.drop_table('user_preferences')
Version Tracking¶
Migration state is stored in the alembic_version table:
-- Check current version
SELECT * FROM alembic_version;
-- Output:
-- version_num
-- 003_preferences
Self-Hosted Migrations¶
For self-hosted deployments, migrations run automatically on container startup:
# docker-compose.yml
services:
app:
image: huitzo/huitzo:latest
command: ["sh", "-c", "huitzo db migrate && uvicorn huitzo.main:app --host 0.0.0.0"]
To run migrations manually:
docker compose exec app huitzo db migrate
Migration Best Practices¶
- Always create reversible migrations - Include both
upgrade()anddowngrade() - Test migrations on a copy - Never run untested migrations on production
- Back up before migrating -
pg_dumpbefore any upgrade - Keep migrations small - One logical change per migration
- Use transactions - Alembic wraps migrations in transactions by default
Logging Configuration¶
Log Levels¶
| Level | Description |
|---|---|
DEBUG |
Detailed debugging information |
INFO |
General operational information |
WARNING |
Warning messages |
ERROR |
Error messages |
CRITICAL |
Critical errors |
Log Format¶
Logs are structured JSON by default:
{
"timestamp": "2026-01-22T12:00:00Z",
"level": "INFO",
"logger": "webcli.api",
"message": "Request completed",
"correlation_id": "abc-123",
"duration_ms": 45
}
Configuration¶
LOG_LEVEL=INFO
LOG_FORMAT=json # json | text
LOG_OUTPUT=stdout # stdout | file
LOG_FILE_PATH=/var/log/huitzo/app.log
Security Configuration¶
Secret Key Generation¶
Generate a secure secret key:
# Python
python -c "import secrets; print(secrets.token_urlsafe(32))"
# OpenSSL
openssl rand -base64 32
HTTPS/TLS¶
For production, always use HTTPS. Configure via reverse proxy (nginx):
server {
listen 443 ssl;
server_name huitzo.ai;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Rate Limiting¶
| Variable | Default | Description |
|---|---|---|
RATE_LIMIT_ENABLED |
true |
Enable rate limiting |
RATE_LIMIT_REQUESTS |
100 |
Requests per window |
RATE_LIMIT_WINDOW |
60 |
Window size (seconds) |
Feature Flags¶
| Variable | Default | Description |
|---|---|---|
FEATURE_DASHBOARD |
true |
Enable dashboard support |
FEATURE_WEBSOCKET |
true |
Enable WebSocket connections |
FEATURE_FILE_UPLOAD |
true |
Enable file uploads |
FEATURE_LLM |
true |
Enable LLM service |
FEATURE_EMAIL |
true |
Enable email service |
FEATURE_TELEGRAM |
false |
Enable Telegram integration |
Example Configuration¶
Development .env¶
# Core
DATABASE_URL=postgresql://huitzo:password@localhost:5432/huitzo
REDIS_URL=redis://localhost:6379/0
SECRET_KEY=dev-secret-key-change-in-production
# Environment
ENVIRONMENT=development
DEBUG=true
LOG_LEVEL=DEBUG
# Services (optional in dev)
OPENAI_API_KEY=sk-...
# Celery
CELERY_TASK_ALWAYS_EAGER=true
Production .env¶
# Core
DATABASE_URL=postgresql://huitzo:[email protected]:5432/huitzo
REDIS_URL=redis://:[email protected]:6379/0
SECRET_KEY=production-secret-key-64-chars-minimum-random
# Environment
ENVIRONMENT=production
DEBUG=false
LOG_LEVEL=INFO
# Security
CORS_ORIGINS=https://cli.huitzo.com,https://hub.huitzo.com
# Services
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
SENDGRID_API_KEY=SG....
# Rate limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW=60
# Self-hosted license
LICENSE_KEY=your-license-key
Related Documentation¶
- Self-Hosting Deployment – Deployment guide
- CLI Reference – CLI commands
- SDK Overview – SDK configuration
- Secrets Management – Three-tier secrets model
- Architecture – System architecture