Files
backend/configs/config.yaml
lan c561a0bb0c feat(grpc): add gRPC server infrastructure and schedule sync service
Add gRPC server support with configurable TLS, environment-based settings, and Wire injection. Implement schedule synchronization service with task runner integration for external course data fetching.

- Add gRPC configuration with env var overrides (APP_GRPC_ENABLED, APP_GRPC_PORT, etc.)
- Create gRPC server infrastructure with runner task management
- Implement ScheduleSyncService for course data synchronization
- Add sync endpoint to schedule handler for external system integration
- Update repository with context-aware batch delete operation
- Wire all dependencies including zap logger for structured logging
2026-03-13 20:40:20 +08:00

204 lines
5.6 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.
# 服务器配置
# 环境变量: 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: 1Panel-redis-dfmM
port: 6379
password: "redis_j8CMza"
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: "files.littlelan.cn"
access_key: "E6bMcYkQzCldRTrtmhvi"
secret_key: "4R9yjmwKNoHphiBkv05Oa8WGEIFbnlZeTLXfSgx3"
bucket: "test"
use_ssl: true
region: us-east-1
domain: "files.littlelan.cn"
# 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: true
address: "http://111.170.19.33:8088" # Gorse server地址
api_key: "" # API密钥
dashboard: "" # Gorse dashboard地址
import_password: "lanyimin123" # 导入数据密码
embedding_api_key: "sk-ZPN5NMPSqEaOGCPfD2LqndZ5Wwmw3DC4CQgzgKhM35fI3RpD"
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: "sk-y7LOeKsNfzbZWTRSFsTs79jd8WYlezbIVgdVPgMvG4Xz2AlV"
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: true
host: "smtp.exmail.qq.com"
port: 465
username: "no-reply@qczlit.cn"
password: "HbvwwVjRyiWg9gsK"
from_address: "no-reply@qczlit.cn"
from_name: "Carrot BBS"
use_tls: true
insecure_skip_verify: false
timeout: 15
# 会话缓存配置
conversation_cache:
# TTL 配置
detail_ttl: 5m # 会话详情缓存时间
list_ttl: 60s # 会话列表缓存时间
participant_ttl: 5m # 参与者缓存时间
unread_ttl: 30s # 未读数缓存时间
# 消息缓存配置
message_detail_ttl: 30m # 单条消息详情缓存
message_list_ttl: 5m # 消息分页列表缓存
message_index_ttl: 30m # 消息索引缓存
message_count_ttl: 30m # 消息计数缓存
# 批量写入配置
batch_interval: 5s # 写入间隔
batch_threshold: 100 # 条数阈值
batch_max_size: 500 # 单次最大批量
buffer_max_size: 10000 # 写缓冲最大条数
# gRPC 服务器配置
# 环境变量:
# APP_GRPC_ENABLED, APP_GRPC_PORT
# APP_GRPC_TLS_ENABLED, APP_GRPC_TLS_CERT_FILE, APP_GRPC_TLS_KEY_FILE
grpc:
enabled: true
port: 50051
tls_enabled: false
tls_cert_file: ""
tls_key_file: ""