env

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2018 License: MIT Imports: 1 Imported by: 13

Documentation

Index

Constants

View Source
const (
	// ID contains default service name.
	ID = "env"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// values to set as worker _ENV.
	Values map[string]string
}

Config defines set of env values for RR workers.

func (*Config) Hydrate

func (c *Config) Hydrate(cfg service.Config) error

Hydrate must populate Config values using given Config source. Must return error if Config is not valid.

type Environment added in v1.2.0

type Environment interface {
	// GetEnv must return list of env variables.
	GetEnv() (map[string]string, error)

	// SetEnv sets or creates environment value.
	SetEnv(key, value string)
}

Provider aggregates list of environment variables. This interface can be used in custom implementation to drive values from external sources.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides ability to map _ENV values from config file.

func NewService

func NewService(defaults map[string]string) *Service

NewService creates new env service instance for given rr version.

func (*Service) GetEnv

func (s *Service) GetEnv() (map[string]string, error)

GetEnv must return list of env variables.

func (*Service) Init

func (s *Service) Init(cfg *Config) (bool, error)

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 (*Service) SetEnv added in v1.2.0

func (s *Service) SetEnv(key, value string)

SetEnv sets or creates environment value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL