Files
OpenFlare/config.example.yaml
T
ryan 13d6966cb5 refactor(db): use version string as primary key for ConfigVersion
-transition `of_config_versions` primary key from `id` to `version` string.
-add database migration files `202606270001_make_version_primary_key.sql` for PostgreSQL and SQLite.
-introduce AfterFind/AfterCreate GORM hooks to preserve JSON backward compatibility.
-refactor API controllers, logics, and front-end typescript definitions to receive `string` parameter.
2026-06-27 13:23:30 +08:00

114 lines
4.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# openflare — Platform Config
# Copy this file to config.yaml and fill in your values.
# Fields marked with <...> are required; others have sensible defaults.
# ─── Application ────────────────────────────────────────────────────────────────
app:
app_name: "openflare"
env: "development" # development | testing | production
addr: ":3000"
node_id: 1 # Snowflake node ID (0-1023). Must be unique per instance.
graceful_shutdown_timeout: 30
session_cookie_name: "openflare_session_id" # Change to something unique before deploy
session_secret: "<uniq-random-string>" # Cannot be changed after first start
session_domain: "" # e.g. ".yourdomain.com"
session_age: 86400 # Session lifetime in seconds (default: 24h)
session_secure: false
session_http_only: false
api_prefix: "/api"
# ─── PostgreSQL ─────────────────────────────────────────────────────────────────
# Supports Standalone and Primary-Replica (read/write split) modes.
database:
enabled: true
sqlite_path: "openflare.db" # PostgreSQL 禁用时使用此 SQLite 文件路径
host: "127.0.0.1"
port: 5432
username: "openflare"
password: "replace-with-strong-password"
database: "openflare"
max_idle_conn: 16
max_open_conn: 128
conn_max_lifetime: 1800
conn_max_idle_time: 600
log_level: "info" # error | warn | info | debug | silent
ssl_mode: "disable"
time_zone: "UTC"
application_name: "openflare-server"
prefer_simple_protocol: false
search_path: "public"
statement_cache_capacity: 256
default_query_exec_mode: "cache_statement"
slow_threshold: 200ms
# Optional read replicas:
# replicas:
# - host: "replica1.db.internal"
# port: 5432
# - host: "replica2.db.internal"
# port: 5432
# ─── Redis ──────────────────────────────────────────────────────────────────────
# Supports Standalone, Sentinel (HA), and Cluster modes.
redis:
enabled: true
addrs:
- "127.0.0.1:6379"
username: ""
password: ""
db: 0 # Ignored in Cluster mode
cluster_mode: false # Set true to enable Cluster mode
master_name: "" # Set non-empty to enable Sentinel mode
key_prefix: "openflare:"
pool_size: 100
min_idle_conn: 10
dial_timeout: 5
read_timeout: 3
write_timeout: 3
max_retries: 3
pool_timeout: 4
conn_max_idle_time: 300
# ─── Logging ────────────────────────────────────────────────────────────────────
log:
level: "info" # debug | info | warn | error | fatal | panic
format: "console" # console | json
output: "stdout" # stdout | file
file_path: "./logs/app.log"
max_size: 100 # MB per log file
max_age: 30 # Days to retain old log files
max_backups: 10
compress: true
# ─── Async Task Worker ──────────────────────────────────────────────────────────
worker:
concurrency: 20
strict_priority: false
queues:
- name: webhook
priority: 10
- name: whitelist_only
priority: 5
- name: default
priority: 3
# ─── OpenTelemetry Tracing ──────────────────────────────────────────────────────
otel:
sampling_rate: 0.0 # Trace sampling rate (0.0 – 1.0)
tracer_name: "github.com/Rain-kl/OpenFlare" # Global tracer instrumentation name
# ─── ClickHouse (required) ──────────────────────────────────────────────────────
clickhouse:
enabled: true
hosts:
- "127.0.0.1:9000"
username: "default"
password: "123456"
database: "openflare"
max_idle_conn: 10
max_open_conn: 100
conn_max_lifetime: 3600
dial_timeout: 5
block_buffer_size: 10