92 lines
1.8 KiB
YAML
92 lines
1.8 KiB
YAML
# TYAPI Server Configuration
|
|
|
|
app:
|
|
name: "TYAPI Server"
|
|
version: "1.0.0"
|
|
env: "development"
|
|
|
|
server:
|
|
host: "0.0.0.0"
|
|
port: "8080"
|
|
mode: "debug"
|
|
read_timeout: 30s
|
|
write_timeout: 30s
|
|
idle_timeout: 120s
|
|
|
|
database:
|
|
host: "localhost"
|
|
port: "5432"
|
|
user: "postgres"
|
|
password: "Pg9mX4kL8nW2rT5y"
|
|
name: "tyapi_dev"
|
|
sslmode: "disable"
|
|
timezone: "Asia/Shanghai"
|
|
max_open_conns: 25
|
|
max_idle_conns: 10
|
|
conn_max_lifetime: 300s
|
|
|
|
redis:
|
|
host: "localhost"
|
|
port: "6379"
|
|
password: ""
|
|
db: 0
|
|
pool_size: 10
|
|
min_idle_conns: 3
|
|
max_retries: 3
|
|
dial_timeout: 5s
|
|
read_timeout: 3s
|
|
write_timeout: 3s
|
|
|
|
cache:
|
|
default_ttl: 3600s
|
|
cleanup_interval: 600s
|
|
max_size: 1000
|
|
|
|
logger:
|
|
level: "info"
|
|
format: "json"
|
|
output: "stdout"
|
|
file_path: "logs/app.log"
|
|
max_size: 100
|
|
max_backups: 3
|
|
max_age: 7
|
|
compress: true
|
|
|
|
jwt:
|
|
secret: "JwT8xR4mN9vP2sL7kH3oB6yC1zA5uF0qE9tW"
|
|
expires_in: 24h
|
|
refresh_expires_in: 168h # 7 days
|
|
|
|
ratelimit:
|
|
requests: 100
|
|
window: 60s
|
|
burst: 50
|
|
|
|
monitoring:
|
|
metrics_enabled: true
|
|
metrics_port: "9090"
|
|
tracing_enabled: false
|
|
tracing_endpoint: "http://localhost:14268/api/traces"
|
|
sample_rate: 0.1
|
|
|
|
health:
|
|
enabled: true
|
|
interval: 30s
|
|
timeout: 10s
|
|
|
|
resilience:
|
|
circuit_breaker_enabled: true
|
|
circuit_breaker_threshold: 5
|
|
circuit_breaker_timeout: 60s
|
|
retry_max_attempts: 3
|
|
retry_initial_delay: 100ms
|
|
retry_max_delay: 5s
|
|
|
|
development:
|
|
debug: true
|
|
enable_profiler: true
|
|
enable_cors: true
|
|
cors_allowed_origins: "http://localhost:3000,http://localhost:3001"
|
|
cors_allowed_methods: "GET,POST,PUT,PATCH,DELETE,OPTIONS"
|
|
cors_allowed_headers: "Origin,Content-Type,Accept,Authorization,X-Requested-With"
|