refactor: 使用配置文件的 URL 来拼接回调 URL
This commit is contained in:
@ -7,16 +7,21 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Server ServerConfig `mapstructure:"server"`
|
||||
type config struct {
|
||||
Server serverConfig `mapstructure:"server"`
|
||||
App appConfig `mapstructure:"app"`
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
type serverConfig struct {
|
||||
Port int `mapstructure:"port"`
|
||||
Host string `mapstructure:"host"`
|
||||
}
|
||||
|
||||
var AppConfig Config
|
||||
type appConfig struct {
|
||||
URL string `mapstructure:"url"`
|
||||
}
|
||||
|
||||
var Conf config
|
||||
|
||||
func LoadConfig() error {
|
||||
env := os.Getenv("PROFILE")
|
||||
@ -37,7 +42,7 @@ func LoadConfig() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := viper.Unmarshal(&AppConfig); err != nil {
|
||||
if err := viper.Unmarshal(&Conf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user