summaryrefslogtreecommitdiff
path: root/service/env/config.go
blob: a7da695e339b170a46e71d9a733e60204ad4ef41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package env

import (
	"github.com/spiral/roadrunner/service"
)

// Config defines set of env values for RR workers.
type Config struct {
	// values to set as worker _ENV.
	Values map[string]string
}

// Hydrate must populate Config values using given Config source. Must return error if Config is not valid.
func (c *Config) Hydrate(cfg service.Config) error {
	return cfg.Unmarshal(&c.Values)
}

// InitDefaults allows to init blank config with pre-defined set of default values.
func (c *Config) InitDefaults() error {
	c.Values = make(map[string]string)
	return nil
}