feat: 新增应用配置管理模块并实现用户认证处理器,支持环境配置加载和GitHub OAuth。

This commit is contained in:
2026-01-26 09:24:59 +08:00
parent e45c8f2f3c
commit b1ca769709
3 changed files with 15 additions and 12 deletions

View File

@@ -47,24 +47,24 @@ type Config struct {
FrontendURL string
// AI configuration (OpenAI compatible)
OpenAIAPIKey string
OpenAIBaseURL string
WhisperModel string
ChatModel string
OpenAIAPIKey string
OpenAIBaseURL string
WhisperModel string
ChatModel string
AISessionTimeout time.Duration
// Image upload configuration
ImageUploadDir string
MaxImageSize int64
AllowedImageTypes string
MaxImagesPerTx int
ImageUploadDir string
MaxImageSize int64
AllowedImageTypes string
MaxImagesPerTx int
}
// Load loads configuration from environment variables
func Load() *Config {
cfg := &Config{
// Server
ServerPort: getEnv("SERVER_PORT", "8080"),
ServerPort: getEnv("SERVER_PORT", "2612"),
Environment: getEnv("ENVIRONMENT", "development"),
// Data directory
@@ -99,7 +99,7 @@ func Load() *Config {
GitHubClientID: getEnv("GITHUB_CLIENT_ID", ""),
GitHubClientSecret: getEnv("GITHUB_CLIENT_SECRET", ""),
GitHubRedirectURL: getEnv("GITHUB_REDIRECT_URL", ""),
FrontendURL: getEnv("FRONTEND_URL", "http://localhost:5173"),
FrontendURL: getEnv("FRONTEND_URL", "http://localhost:2613"),
// AI (OpenAI compatible)
OpenAIAPIKey: getEnv("OPENAI_API_KEY", ""),