nacos config
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/fsconfig"
|
||||
|
||||
{{.importPackages}}
|
||||
)
|
||||
@@ -16,8 +17,10 @@ var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file"
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
cfgContent := fsconfig.StartNacosConfig(configFile,nil)
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
conf.LoadConfigFromYamlBytes([]byte(cfgContent),&c)
|
||||
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
@@ -13,7 +13,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c gateway.GatewayConf
|
||||
conf.MustLoad(*configFile, &c)
|
||||
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
gw := gateway.MustNewServer(c)
|
||||
defer gw.Stop()
|
||||
|
||||
@@ -18,8 +18,10 @@ var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file"
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
cfgContent := fsconfig.StartNacosConfig(configFile,nil)
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
conf.LoadConfigFromYamlBytes([]byte(cfgContent),&c)
|
||||
|
||||
c.Timeout = int64(time.Second * 15)
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user