config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The Hostname of the feudal backends host
	Hostname string `json:"feudal_backend_host"`

	// The Username of this client, registered at the backend.
	Username string `json:"username"`

	// The Password of this client, registered at the backend.
	Password string `json:"password"`

	// Services maps an (arbitrary) service identifier to service structs
	// the service identifiers are referenced in GroupToServiceIDs and EntitlementToServiceIDs
	Services map[ServiceID]Service

	// GroupToServiceIDs determines which services are provided for users of the
	// group
	// maps a group name to service identifiers of the services
	// services are declared in Config.Services
	GroupToServiceIDs map[string][]ServiceID `json:"group_to_service_ids"`

	// EntitlementToServiceIDs determines which services are provided for users of the
	// entitlement
	// maps an entitlement to service identifiers of the services
	// services are declared in Config.Services
	EntitlementToServiceIDs map[string][]ServiceID `json:"entitlement_to_service_ids"`

	// FetchIntervalString gets parsed by time.ParseDuration
	FetchIntervalString string `json:"fetch_interval"`

	// ReconnectTimeout gets parsed by time.ParseDuration
	ReconnectTimeoutString string `json:"reconnect_timeout"`

	// After the duration of FetchInterval the client will fetch updates using the REST
	// interface.
	FetchInterval time.Duration

	// We reconnect to RabbitMQ after ReconnectTimeout.
	ReconnectTimeout time.Duration

	RabbitMQConfig RabbitMQConfig

	// The Site is the name of the site of this client. It is fetched from the backend.
	Site string

	// Debug flags control the log levels of the client.
	Debug DebugConfig `json:"debug"`
}

Config is the structure of our config file

func ReadConfig

func ReadConfig(configFile string) (conf *Config, err error)

ReadConfig reads a config file and validates it

func (*Config) GetServices

func (conf *Config) GetServices(sids []ServiceID) (services []Service, err error)

GetServices resolves service ids into services

func (*Config) Sync

func (conf *Config) Sync() (err error)

Sync sends our config to the backend to inform it about changes

type DebugConfig

type DebugConfig struct {
	// Sequential causes the execution of only one deployment at a time for debugging purposes
	Sequential bool `json:"sequential_execution"`
	Scripts    bool `json:"scripts"`
	Backend    bool `json:"backend"`
}

The DebugConfig sets the debuging levels for components of the client.

type RabbitMQConfig

type RabbitMQConfig struct {
	Exchanges []string `json:"exchanges"`
	Vhost     string   `json:"vhost"`
}

RabbitMQConfig is used for the amqp source

type Service

type Service struct {
	Name        string `json:"name"`
	Command     string `json:"command"`
	Description string `json:"description"`
}

Service for which we do deployments

func (Service) String

func (s Service) String() string

type ServiceID

type ServiceID string

A ServiceID locally identies a provided Service.

Jump to

Keyboard shortcuts

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