config

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkerNameConfirmJob  = "confirm-job"
	WorkerNameCreateTask  = "create-task"
	WorkerNameReconcile   = "reconcile"
	WorkerNameNotifyEvent = "notify-event"
)

Variables

View Source
var (
	ErrEmptyRegion               = errors.New("region must not be empty")
	ErrNilConnection             = errors.New("connection configuration is missing")
	ErrUnsupportedConnectionType = errors.New("connection type is not supported")
	ErrNilAuth                   = errors.New("authentication configuration is missing")
	ErrUnsupportedAuthType       = errors.New("authentication type is not supported")

	ErrAMQPConfigMissing = errors.New("AMQP configuration is missing")
	ErrEmptyURL          = errors.New("URL must not be empty")
	ErrEmptySource       = errors.New("source must not be empty")
	ErrEmptyTarget       = errors.New("target must not be empty")

	ErrEmptyCAFile   = errors.New("CA file must not be empty")
	ErrEmptyCertFile = errors.New("certificate file must not be empty")
	ErrEmptyKeyFile  = errors.New("key file must not be empty")

	ErrEmptyWorkerName                      = errors.New("worker name must not be empty")
	ErrExecIntervalMustBeGreaterThanZero    = errors.New("worker exec interval must be greater than zero")
	ErrUnsupportedWorkerName                = errors.New("worker name is not supported, please use one of the predefined worker names (confirm-job, create-task, reconcile, notify-event)")
	ErrNumberOfWorkersMustBeGreaterThanZero = errors.New("number of workers must be greater than zero")
	ErrTimeoutMustBeGreaterThanZero         = errors.New("timeout must be greater than zero")

	ErrConfirmJobAfterMustBeEqualGreaterThanZero = errors.New("confirm job delay must be equal or greater than zero")
	ErrTaskLimitNumMustBeGreaterThanZero         = errors.New("task limit number must be greater than zero")
	ErrMaxReconcileCountMustBeGreaterThanZero    = errors.New("max reconcile count must be greater than zero")
	ErrBackoffBaseIntervalMustBeGreaterThanZero  = errors.New("backoff base interval must be greater than zero")
	ErrBackoffMaxIntervalMustBeGreaterThanZero   = errors.New("backoff max interval must be greater than zero")
)

Functions

This section is empty.

Types

type AMQP

type AMQP struct {
	Url    string `yaml:"url" json:"url"`
	Source string `yaml:"source" json:"source"`
	Target string `yaml:"target" json:"target"`
}

type Auth

type Auth struct {
	Type AuthType `yaml:"type" json:"type"`
	MTLS *MTLS    `yaml:"mtls" json:"mtls"`
}

type AuthType

type AuthType string
const (
	AuthTypeMTLS AuthType = "mtls"
	AuthTypeNone AuthType = "none"
)

type Config

type Config struct {
	commoncfg.BaseConfig `mapstructure:",squash"`

	// gRPC server configuration
	GRPCServer GRPCServer `yaml:"grpcServer"`
	// Database configuration
	Database DB `yaml:"database" json:"database"`
	// Orbital configuration
	Orbital Orbital `yaml:"orbital" json:"orbital"`
	// Validations configuration
	Validations []validation.ConfigField `yaml:"validations"`
}

Config holds all application configuration parameters.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type Connection

type Connection struct {
	Type ConnectionType `yaml:"type" json:"type"`
	AMQP *AMQP          `yaml:"amqp" json:"amqp"`
	Auth Auth           `yaml:"auth" json:"auth"`
}

type ConnectionType

type ConnectionType string
const (
	ConnectionTypeAMQP ConnectionType = "amqp"
)

type DB

type DB struct {
	Host     string              `yaml:"host" json:"host"`
	User     commoncfg.SourceRef `yaml:"user" json:"user"`
	Password commoncfg.SourceRef `yaml:"password" json:"password"`
	Name     string              `yaml:"name" json:"name"` // database name
	Port     string              `yaml:"port" json:"port"`
	LogLevel int                 `yaml:"logLevel" json:"logLevel" default:"1"`
}

DB holds DB config.

type GRPCServer

type GRPCServer struct {
	commoncfg.GRPCServer `mapstructure:",squash"`

	// also embed client attributes for the gRPC health check client
	Client commoncfg.GRPCClient `yaml:"client" json:"client"`
}

GRPCServer configuration.

type MTLS

type MTLS struct {
	CAFile   string `yaml:"caFile" json:"caFile"`
	CertFile string `yaml:"certFile" json:"certFile"`
	KeyFile  string `yaml:"keyFile" json:"keyFile"`
}

type Orbital

type Orbital struct {
	ConfirmJobAfter        time.Duration `yaml:"confirmJobAfter" json:"confirmJobAfter"`
	TaskLimitNum           int           `yaml:"taskLimitNum" json:"taskLimitNum"`
	MaxReconcileCount      int64         `yaml:"maxReconcileCount" json:"maxReconcileCount"`
	BackoffBaseIntervalSec int64         `yaml:"backoffBaseIntervalSec" json:"backoffBaseIntervalSec"`
	BackoffMaxIntervalSec  int64         `yaml:"backoffMaxIntervalSec" json:"backoffMaxIntervalSec"`
	Targets                []Target      `yaml:"targets" json:"targets"`
	Workers                []Worker      `yaml:"workers" json:"workers"`
}

func (*Orbital) GetWorker

func (o *Orbital) GetWorker(workerName string) *Worker

func (*Orbital) Validate

func (o *Orbital) Validate() error

type Server

type Server struct {
	Port string `yaml:"port"`
}

Server holds server config.

type Target

type Target struct {
	Region     string      `yaml:"region" json:"region"`
	Connection *Connection `yaml:"connection" json:"connection"`
}

type Worker

type Worker struct {
	Name         string        `yaml:"name" json:"name"`
	NoOfWorkers  int           `yaml:"noOfWorkers" json:"noOfWorkers"`
	ExecInterval time.Duration `yaml:"execInterval" json:"execInterval"`
	Timeout      time.Duration `yaml:"timeout" json:"timeout"`
}

Jump to

Keyboard shortcuts

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