env

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 1 Imported by: 13

Documentation

Index

Constants

View Source
const ID = "env"

ID contains default service name.

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.

func (*Config) InitDefaults added in v1.2.2

func (c *Config) InitDefaults() error

InitDefaults allows to init blank config with pre-defined set of default values.

type Environment added in v1.2.0

type Environment interface {
	Setter
	Getter

	// Copy all environment values.
	Copy(setter Setter) error
}

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

type Getter added in v1.3.0

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

Getter provides ability to set environment value.

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) Copy added in v1.3.0

func (s *Service) Copy(setter Setter) error

Copy all environment values.

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.

type Setter added in v1.3.0

type Setter interface {
	// SetEnv sets or creates environment value.
	SetEnv(key, value string)
}

Setter provides ability to set environment value.

Jump to

Keyboard shortcuts

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