nacos config

This commit is contained in:
eson
2023-09-19 11:41:38 +08:00
parent d7f94f0da9
commit b4672bbed7
29 changed files with 208 additions and 124 deletions

View File

@@ -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) {

View File

@@ -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()

View File

@@ -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)