mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-20 20:44:51 -04:00
allow providing list of services not to start
Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
7
changelog/unreleased/exclude-services-option.md
Normal file
7
changelog/unreleased/exclude-services-option.md
Normal file
@@ -0,0 +1,7 @@
|
||||
Enhancement: Allow providing list of services NOT to start
|
||||
|
||||
Until now if one wanted to use a custom version of a service, one
|
||||
needed to provide `OCIS_RUN_SERVICES` which is a list of all services to start.
|
||||
Now one can provide `OCIS_EXCLUDE_RUN_SERVICES` which is a list of only services not to start
|
||||
|
||||
https://github.com/owncloud/ocis/pull/4254
|
||||
@@ -49,7 +49,8 @@ type Mode int
|
||||
type Runtime struct {
|
||||
Port string `yaml:"port" env:"OCIS_RUNTIME_PORT"`
|
||||
Host string `yaml:"host" env:"OCIS_RUNTIME_HOST"`
|
||||
Extensions string `yaml:"services" env:"OCIS_RUN_EXTENSIONS;OCIS_RUN_SERVICES"`
|
||||
Extensions string `yaml:"services" env:"OCIS_RUN_EXTENSIONS;OCIS_RUN_SERVICES" desc:"Expects a space seperated list of service names. Will start only the listed services."`
|
||||
Disabled string `yaml:"disabled_services" env:"OCIS_EXCLUDE_RUN_SERVICES" desc:"Expects a space seperated list of service names. Will start all services except of the ones listed. Has no effect when OCIS_RUN_SERVICES is set."`
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
|
||||
@@ -248,12 +248,24 @@ func (s *Service) generateRunSet(cfg *ociscfg.Config) {
|
||||
return
|
||||
}
|
||||
|
||||
disabled := make(map[string]bool)
|
||||
if cfg.Runtime.Disabled != "" {
|
||||
e := strings.Split(strings.ReplaceAll(cfg.Runtime.Disabled, " ", ""), ",")
|
||||
for _, s := range e {
|
||||
disabled[s] = true
|
||||
}
|
||||
}
|
||||
|
||||
for name := range s.ServicesRegistry {
|
||||
runset = append(runset, name)
|
||||
if !disabled[name] {
|
||||
runset = append(runset, name)
|
||||
}
|
||||
}
|
||||
|
||||
for name := range s.Delayed {
|
||||
runset = append(runset, name)
|
||||
if !disabled[name] {
|
||||
runset = append(runset, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user