context

package
v0.0.0-...-87de96b Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PostMethodSupported ...
	PostMethodSupported = "only post method is allowed"
	// CredentialsError ...
	CredentialsError = "credentials error"
	// TokenError ...
	TokenError = "token error"
	// UnauthorizedAccess ...
	UnauthorizedAccess = "unauthorized access"
)

Variables

This section is empty.

Functions

func BrokerClient

func BrokerClient(host string, port int) (pb.EndpointClient, error)

BrokerClient establishes a new gRPC client connection with a broker endpoint

func ConfigureClient

func ConfigureClient(config *MasterConfig) (pb.ConfigureEndpointClient, error)

ConfigureClient creates a connection to the configure gRPC service

func ConnectClient

func ConnectClient(config *BrokerConfig) (*mdp.Client, error)

ConnectClient connects a broker service client at the configured endpoint

func ManagerClient

func ManagerClient(config *MasterConfig) (pb.ManagerClient, error)

ManagerClient creates a client connection to the plantctl manager service

func OpenDB

func OpenDB(config *MasterConfig) (*gorm.DB, error)

OpenDB establishes a connection to the database

func OpenMongoDB

func OpenMongoDB(config *ConfigureConfig) (*mongo.Database, error)

Types

type BrokerConfig

type BrokerConfig struct {
	Env               string          `mapstructure:"env"`
	Endpoint          string          `mapstructure:"endpoint"`
	ClientEndpoint    string          `mapstructure:"client-endpoint"`
	HeartbeatLiveness int             `mapstructure:"heartbeat-liveness"`
	HeartbeatInterval int             `mapstructure:"heartbeat-interval"`
	Configure         configure       `mapstructure:"configure"`
	Units             map[string]unit `mapstructure:"units"`
	Log               logging         `mapstructure:"log"`
}

func LoadBrokerConfig

func LoadBrokerConfig() (*BrokerConfig, error)

type Config

type Config interface {
	Has(setting string) bool
}

Config provides a common configuration file interface

type ConfigureConfig

type ConfigureConfig struct {
	DB     database  `mapstructure:"db"`
	Log    logging   `mapstructure:"log"`
	Server configure `mapstructure:"server"`
}

func LoadConfigureConfig

func LoadConfigureConfig(path string) (*ConfigureConfig, error)

LoadConfigureConfig loads a configuration file from disk

type EventsConfig

type EventsConfig struct {
	Name     string  `mapstructure:"name"`
	Unit     string  `mapstructure:"unit"`
	Filter   string  `mapstructure:"filter"`
	Frontend string  `mapstructure:"frontend"`
	Backend  string  `mapstructure:"backend"`
	Capture  string  `mapstructure:"capture"`
	Log      logging `mapstructure:"log"`
}

func LoadEventsConfig

func LoadEventsConfig() (*EventsConfig, error)

type MasterConfig

type MasterConfig struct {
	App           string            `mapstructure:"app"`
	Host          string            `mapstructure:"host"`
	Port          int               `mapstructure:"port"`
	URISchema     string            `mapstructure:"uri-schema"`
	Version       string            `mapstructure:"version"`
	SessionSecret string            `mapstructure:"session-secret"`
	GraphQL       gql               `mapstructure:"graphql"`
	Auth          auth              `mapstructure:"auth"`
	Broker        map[string]client `mapstructure:"broker"`
	Configure     configure         `mapstructure:"configure"`
	DB            database          `mapstructure:"db"`
	Log           logging           `mapstructure:"log"`
	Manager       client            `mapstructure:"manager"`
}

MasterConfig provides configuration information for the master application

func LoadMasterConfig

func LoadMasterConfig(path string) (*MasterConfig, error)

LoadMasterConfig loads a configuration file from disk

func (*MasterConfig) ListenEndpoint

func (c *MasterConfig) ListenEndpoint() string

ListenEndpoint builds the endpoint string (host + port)

func (*MasterConfig) SchemaVersionedEndpoint

func (c *MasterConfig) SchemaVersionedEndpoint(path string) string

SchemaVersionedEndpoint builds the schema endpoint string (schema + host + port + version)

func (*MasterConfig) VersionedEndpoint

func (c *MasterConfig) VersionedEndpoint(path string) string

VersionedEndpoint builds the endpoint string (host + port + version)

type MetricsConfig

type MetricsConfig struct {
	Name     string  `mapstructure:"name"`
	Unit     string  `mapstructure:"unit"`
	Filter   string  `mapstructure:"filter"`
	Frontend string  `mapstructure:"frontend"`
	Backend  string  `mapstructure:"backend"`
	Capture  string  `mapstructure:"capture"`
	Log      logging `mapstructure:"log"`
}

func LoadMetricsConfig

func LoadMetricsConfig() (*MetricsConfig, error)

Jump to

Keyboard shortcuts

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