24 lines
565 B
Go
24 lines
565 B
Go
|
package env
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
|
||
|
"git.wishpal.cn/wishpal_ironfan/xframe/component/agollo/utils"
|
||
|
)
|
||
|
|
||
|
// ApolloConfig apollo配置
|
||
|
type ApolloConfig struct {
|
||
|
NamespaceName string `json:"namespaceName"`
|
||
|
Configurations map[string]string `json:"configurations"`
|
||
|
}
|
||
|
|
||
|
// CreateApolloConfigWithJSON 使用json配置转换成apollo config
|
||
|
func CreateApolloConfigWithJSON(b []byte) (*ApolloConfig, error) {
|
||
|
apolloConfig := &ApolloConfig{}
|
||
|
err := json.Unmarshal(b, apolloConfig)
|
||
|
if utils.IsNotNil(err) {
|
||
|
return nil, err
|
||
|
}
|
||
|
return apolloConfig, nil
|
||
|
}
|