Set up project files and add .gitignore to exclude local build/runtime artifacts. Made-with: Cursor
173 lines
4.4 KiB
YAML
173 lines
4.4 KiB
YAML
# 服务器配置
|
||
# 环境变量: APP_SERVER_HOST, APP_SERVER_PORT, APP_SERVER_MODE
|
||
server:
|
||
host: 0.0.0.0
|
||
port: 8080
|
||
mode: debug
|
||
|
||
# 数据库配置
|
||
# 环境变量:
|
||
# SQLite: APP_DATABASE_SQLITE_PATH
|
||
# Postgres: APP_DATABASE_POSTGRES_HOST, APP_DATABASE_POSTGRES_PORT, APP_DATABASE_POSTGRES_USER,
|
||
# APP_DATABASE_POSTGRES_PASSWORD, APP_DATABASE_POSTGRES_DBNAME
|
||
database:
|
||
type: sqlite # sqlite 或 postgres
|
||
sqlite:
|
||
path: ./data/carrot_bbs.db
|
||
postgres:
|
||
host: localhost
|
||
port: 5432
|
||
user: postgres
|
||
password: postgres
|
||
dbname: carrot_bbs
|
||
sslmode: disable
|
||
max_idle_conns: 10
|
||
max_open_conns: 100
|
||
log_level: warn
|
||
slow_threshold_ms: 200
|
||
ignore_record_not_found: true
|
||
parameterized_queries: true
|
||
|
||
# Redis配置
|
||
# 环境变量:
|
||
# 类型: APP_REDIS_TYPE (miniredis/redis)
|
||
# Redis: APP_REDIS_REDIS_HOST, APP_REDIS_REDIS_PORT, APP_REDIS_REDIS_PASSWORD, APP_REDIS_REDIS_DB
|
||
# Miniredis: APP_REDIS_MINIREDIS_HOST, APP_REDIS_MINIREDIS_PORT
|
||
redis:
|
||
type: miniredis # miniredis 或 redis
|
||
redis:
|
||
host: localhost
|
||
port: 6379
|
||
password: ""
|
||
db: 0
|
||
miniredis:
|
||
host: localhost
|
||
port: 6379
|
||
pool_size: 10
|
||
|
||
# 缓存配置
|
||
# 环境变量:
|
||
# APP_CACHE_ENABLED, APP_CACHE_KEY_PREFIX, APP_CACHE_DEFAULT_TTL, APP_CACHE_NULL_TTL
|
||
# APP_CACHE_JITTER_RATIO, APP_CACHE_DISABLE_FLUSHDB
|
||
# APP_CACHE_MODULES_POST_LIST_TTL, APP_CACHE_MODULES_CONVERSATION_TTL
|
||
# APP_CACHE_MODULES_UNREAD_COUNT_TTL, APP_CACHE_MODULES_GROUP_MEMBERS_TTL
|
||
cache:
|
||
enabled: true
|
||
key_prefix: ""
|
||
default_ttl: 30
|
||
null_ttl: 5
|
||
jitter_ratio: 0.1
|
||
disable_flushdb: true
|
||
modules:
|
||
post_list_ttl: 30
|
||
conversation_ttl: 60
|
||
unread_count_ttl: 30
|
||
group_members_ttl: 120
|
||
|
||
# S3对象存储配置
|
||
# 环境变量: APP_S3_ENDPOINT, APP_S3_ACCESS_KEY, APP_S3_SECRET_KEY, APP_S3_BUCKET, APP_S3_DOMAIN
|
||
s3:
|
||
endpoint: ""
|
||
access_key: ""
|
||
secret_key: ""
|
||
bucket: ""
|
||
use_ssl: true
|
||
region: us-east-1
|
||
domain: ""
|
||
# JWT配置
|
||
# 环境变量: APP_JWT_SECRET
|
||
jwt:
|
||
secret: your-jwt-secret-key-change-in-production
|
||
access_token_expire: 86400 # 24 hours in seconds
|
||
refresh_token_expire: 604800 # 7 days in seconds
|
||
|
||
log:
|
||
level: info
|
||
encoding: json
|
||
output_paths:
|
||
- stdout
|
||
- ./logs/app.log
|
||
|
||
rate_limit:
|
||
enabled: true
|
||
requests_per_minute: 60
|
||
|
||
upload:
|
||
max_file_size: 10485760 # 10MB
|
||
allowed_types:
|
||
- image/jpeg
|
||
- image/png
|
||
- image/gif
|
||
- image/webp
|
||
|
||
# 敏感词过滤配置
|
||
sensitive:
|
||
enabled: true
|
||
replace_str: "***"
|
||
min_match_len: 1
|
||
load_from_db: true
|
||
load_from_redis: false
|
||
redis_key_prefix: "sensitive_words"
|
||
|
||
# 内容审核服务配置
|
||
audit:
|
||
enabled: false # 暂时关闭第三方审核
|
||
# 审核服务提供商: local, aliyun, tencent, baidu
|
||
provider: "local"
|
||
auto_audit: true
|
||
timeout: 30
|
||
# 阿里云配置
|
||
aliyun_access_key: ""
|
||
aliyun_secret_key: ""
|
||
aliyun_region: "cn-shanghai"
|
||
# 腾讯云配置
|
||
tencent_secret_id: ""
|
||
tencent_secret_key: ""
|
||
# 百度云配置
|
||
baidu_api_key: ""
|
||
baidu_secret_key: ""
|
||
|
||
# Gorse推荐系统配置
|
||
# 环境变量: APP_GORSE_ADDRESS, APP_GORSE_API_KEY, APP_GORSE_DASHBOARD, APP_GORSE_IMPORT_PASSWORD
|
||
gorse:
|
||
enabled: false
|
||
address: "" # Gorse server地址
|
||
api_key: "" # API密钥
|
||
dashboard: "" # Gorse dashboard地址
|
||
import_password: "" # 导入数据密码
|
||
embedding_api_key: ""
|
||
embedding_url: "https://api.littlelan.cn/v1/embeddings"
|
||
embedding_model: "BAAI/bge-m3"
|
||
|
||
# OpenAI兼容接口配置(用于帖子审核,支持图文)
|
||
# 环境变量:
|
||
# APP_OPENAI_ENABLED, APP_OPENAI_BASE_URL, APP_OPENAI_API_KEY
|
||
# APP_OPENAI_MODERATION_MODEL, APP_OPENAI_MODERATION_MAX_IMAGES_PER_REQUEST
|
||
# APP_OPENAI_REQUEST_TIMEOUT, APP_OPENAI_STRICT_MODERATION
|
||
openai:
|
||
enabled: true
|
||
base_url: "https://api.littlelan.cn/"
|
||
api_key: ""
|
||
moderation_model: "qwen3.5-122b"
|
||
moderation_max_images_per_request: 1
|
||
request_timeout: 30
|
||
strict_moderation: false
|
||
|
||
# SMTP发信配置(gomail.v2)
|
||
# 环境变量:
|
||
# APP_EMAIL_ENABLED, APP_EMAIL_HOST, APP_EMAIL_PORT
|
||
# APP_EMAIL_USERNAME, APP_EMAIL_PASSWORD
|
||
# APP_EMAIL_FROM_ADDRESS, APP_EMAIL_FROM_NAME
|
||
# APP_EMAIL_USE_TLS, APP_EMAIL_INSECURE_SKIP_VERIFY, APP_EMAIL_TIMEOUT
|
||
email:
|
||
enabled: false
|
||
host: ""
|
||
port: 587
|
||
username: ""
|
||
password: ""
|
||
from_address: ""
|
||
from_name: "Carrot BBS"
|
||
use_tls: true
|
||
insecure_skip_verify: false
|
||
timeout: 15
|