diff options
author | Valery Piashchynski <[email protected]> | 2020-10-13 13:55:20 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-10-13 13:55:20 +0300 |
commit | 0dc44d54cfcc9dd3fa09a41136f35a9a8d26b994 (patch) | |
tree | ffcb65010bebe9f5b5436192979e64b2402a6ec0 /service/env/service.go | |
parent | 08d6b6b7f773f83b286cd48c1a0fbec9a62fb42b (diff) |
Initial commit of RR 2.0v2.0.0-alpha1
Diffstat (limited to 'service/env/service.go')
-rw-r--r-- | service/env/service.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/service/env/service.go b/service/env/service.go deleted file mode 100644 index 83175b36..00000000 --- a/service/env/service.go +++ /dev/null @@ -1,55 +0,0 @@ -package env - -// ID contains default service name. -const ID = "env" - -// Service provides ability to map _ENV values from config file. -type Service struct { - // values is default set of values. - values map[string]string -} - -// NewService creates new env service instance for given rr version. -func NewService(defaults map[string]string) *Service { - s := &Service{values: defaults} - return s -} - -// Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of -// misconfiguration. Services must not be used without proper configuration pushed first. -func (s *Service) Init(cfg *Config) (bool, error) { - if s.values == nil { - s.values = make(map[string]string) - s.values["RR"] = "true" - } - - for k, v := range cfg.Values { - s.values[k] = v - } - - return true, nil -} - -// GetEnv must return list of env variables. -func (s *Service) GetEnv() (map[string]string, error) { - return s.values, nil -} - -// SetEnv sets or creates environment value. -func (s *Service) SetEnv(key, value string) { - s.values[key] = value -} - -// Copy all environment values. -func (s *Service) Copy(setter Setter) error { - values, err := s.GetEnv() - if err != nil { - return err - } - - for k, v := range values { - setter.SetEnv(k, v) - } - - return nil -} |