copy config, since it is shared

This commit is contained in:
A.Unger
2021-03-10 16:35:11 +01:00
parent 9424caede8
commit 4ee52cc9cd
2 changed files with 9 additions and 3 deletions
+1
View File
@@ -10,6 +10,7 @@ require (
github.com/asim/go-micro/v3 v3.5.1-0.20210217182006-0f0ace1a44a9
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/micro/cli/v2 v2.1.2
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/olekukonko/tablewriter v0.0.5
github.com/openzipkin/zipkin-go v0.2.5
github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20210204050952-c291e4c5b73f
+8 -3
View File
@@ -13,6 +13,8 @@ import (
"syscall"
"time"
"github.com/mohae/deepcopy"
mzlog "github.com/asim/go-micro/plugins/logger/zerolog/v3"
accounts "github.com/owncloud/ocis/accounts/pkg/command"
ocs "github.com/owncloud/ocis/ocs/pkg/command"
@@ -165,7 +167,8 @@ func Start(o ...Option) error {
}()
for name := range s.ServicesRegistry {
s.serviceToken[name] = append(s.serviceToken[name], s.Supervisor.Add(s.ServicesRegistry[name](s.context, s.cfg)))
swap := deepcopy.Copy(s.cfg)
s.serviceToken[name] = append(s.serviceToken[name], s.Supervisor.Add(s.ServicesRegistry[name](s.context, swap.(*ociscfg.Config))))
}
go s.Supervisor.ServeBackground()
@@ -176,7 +179,8 @@ func Start(o ...Option) error {
time.Sleep(2 * time.Second)
// add delayed
for name := range s.Delayed {
s.serviceToken[name] = append(s.serviceToken[name], s.Supervisor.Add(s.Delayed[name](s.context, s.cfg)))
swap := deepcopy.Copy(s.cfg)
s.serviceToken[name] = append(s.serviceToken[name], s.Supervisor.Add(s.Delayed[name](s.context, swap.(*ociscfg.Config))))
}
return http.Serve(l, nil)
@@ -188,7 +192,8 @@ func (s *Service) Start(name string, reply *int) error {
*reply = 1
return nil
}
s.serviceToken[name] = append(s.serviceToken[name], s.Supervisor.Add(s.ServicesRegistry[name](s.context, s.cfg)))
swap := deepcopy.Copy(s.cfg)
s.serviceToken[name] = append(s.serviceToken[name], s.Supervisor.Add(s.ServicesRegistry[name](s.context, swap.(*ociscfg.Config))))
*reply = 0
return nil
}