19 lines
491 B
Go
19 lines
491 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"lone-services/pkg/utils"
|
|
"lone-services/pkg/wechat/auth"
|
|
)
|
|
|
|
func NewWechatClient(clientCode string) (*auth.Client, error) {
|
|
prefix := "wechat." + clientCode
|
|
appID := utils.GetConfigString(prefix + ".app_id")
|
|
secret := utils.GetConfigString(prefix + ".app_secret")
|
|
if appID == utils.StringEmpty || secret == utils.StringEmpty {
|
|
return nil, fmt.Errorf("wechat config missing for client %s", clientCode)
|
|
}
|
|
return auth.NewClient(appID, secret), nil
|
|
}
|