Integrate WeChat Official Account support and update configuration
- Added WeChat Official Account configuration options to .env.example and config.go for OAuth2 integration. - Updated main.go to initialize WeChat OAuth handler and register routes for handling OAuth requests. - Enhanced documentation to include references for WeChat Official Account functionality. - Updated route registration to accommodate the new OAuth handler for improved API structure.
This commit is contained in:
@@ -15,6 +15,7 @@ type Config struct {
|
||||
JWT JWTConfig
|
||||
ShortVideo ShortVideoConfig
|
||||
Qiniu QiniuConfig
|
||||
WeChatOA WeChatOfficialConfig
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -53,6 +54,13 @@ type QiniuConfig struct {
|
||||
TokenExpireSeconds int
|
||||
}
|
||||
|
||||
// WeChatOfficialConfig 用于微信公众号网页授权(OAuth2)相关接口。
|
||||
type WeChatOfficialConfig struct {
|
||||
AppID string
|
||||
AppSecret string
|
||||
RequestTimeout time.Duration
|
||||
}
|
||||
|
||||
var AppConfig *Config
|
||||
|
||||
func LoadConfig() {
|
||||
@@ -91,6 +99,11 @@ func LoadConfig() {
|
||||
KeyPrefix: getEnv("QINIU_KEY_PREFIX", "uploads/"),
|
||||
TokenExpireSeconds: getEnvAsInt("QINIU_TOKEN_EXPIRE_SECONDS", 300),
|
||||
},
|
||||
WeChatOA: WeChatOfficialConfig{
|
||||
AppID: getEnv("WECHAT_OA_APP_ID", ""),
|
||||
AppSecret: getEnv("WECHAT_OA_APP_SECRET", ""),
|
||||
RequestTimeout: time.Duration(getEnvAsInt("WECHAT_OA_TIMEOUT_SECONDS", 5)) * time.Second,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user