aconfig

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	TypeMeta   `json:",inline"`
	ObjectMeta `json:"metadata,omitempty"`
	Spec       ApplicationSpec `json:"spec,omitempty"`
}

func New

func New(configFile string, funcs ...PreProcessFunc) (*Application, error)

func (*Application) GetAPIVersion

func (a *Application) GetAPIVersion() string

func (*Application) GetCustomConfig

func (a *Application) GetCustomConfig() KV

func (*Application) GetMatchedPrimaryPort

func (a *Application) GetMatchedPrimaryPort(name PortName) *MatchedPrimaryPort

func (*Application) GetMatchedPrimaryPortLocation

func (a *Application) GetMatchedPrimaryPortLocation(name PortName) *Location

func (*Application) GetName

func (a *Application) GetName() string

func (*Application) GetSecondaryPort

func (a *Application) GetSecondaryPort(name PortName) *SecondaryPort

func (*Application) GetSecondaryPorts

func (a *Application) GetSecondaryPorts() map[PortName]SecondaryPort

type ApplicationSpec

type ApplicationSpec struct {
	PrimaryPorts   map[PortName]PrimaryPort   `json:"primary_ports,omitempty"`
	SecondaryPorts map[PortName]SecondaryPort `json:"secondary_ports,omitempty"`
	CustomConfig   KV                         `json:"custom_config,omitempty"`
}

type Common

type Common struct {
	Log       Log       `json:"log,omitempty"`
	Database  Database  `json:"database,omitempty"`
	Encryptor Encryptor `json:"encryptor,omitempty"`
	Var       Var       `json:"var,omitempty"`
}

func (*Common) Complete

func (c *Common) Complete(applicationName string)

type Database

type Database struct {
	MaxOpenConnections        int   `json:"max_open_connections,omitempty"`
	MaxIdleConnections        int   `json:"max_idle_connections,omitempty"`
	ConnectionMaxLifeSeconds  int64 `json:"connection_max_life_seconds,omitempty"`
	ConnectionMaxIdleSeconds  int64 `json:"connection_max_idle_seconds,omitempty"`
	SlowThresholdMilliseconds int64 `json:"slow_threshold_milliseconds,omitempty"`
}

type Encryptor added in v0.0.14

type Encryptor struct {
	S string `json:"s,omitempty"`
}

type Interface

type Interface struct {
	Name string `json:"name,omitempty"`
}

type KV

type KV map[string]interface{}

func (KV) Get

func (kv KV) Get(key string) interface{}

func (KV) GetBool

func (kv KV) GetBool(key string) bool

func (KV) GetDuration

func (kv KV) GetDuration(key string) time.Duration

func (KV) GetFloat64

func (kv KV) GetFloat64(key string) float64

func (KV) GetInt

func (kv KV) GetInt(key string) int

func (KV) GetInt32

func (kv KV) GetInt32(key string) int32

func (KV) GetInt64

func (kv KV) GetInt64(key string) int64

func (KV) GetString

func (kv KV) GetString(key string) string

func (KV) GetStringMap

func (kv KV) GetStringMap(key string) map[string]interface{}

func (KV) GetStringMapString

func (kv KV) GetStringMapString(key string) map[string]string

func (KV) GetStringMapStringSlice

func (kv KV) GetStringMapStringSlice(key string) map[string][]string

func (KV) GetStringSlice

func (kv KV) GetStringSlice(key string) []string

func (KV) GetTime

func (kv KV) GetTime(key string) time.Time

func (KV) GetUint

func (kv KV) GetUint(key string) uint

func (KV) GetUint32

func (kv KV) GetUint32(key string) uint32

func (KV) GetUint64

func (kv KV) GetUint64(key string) uint64

func (KV) LoadTo

func (kv KV) LoadTo(out interface{}) error

type Location

type Location struct {
	Address string `json:"address,omitempty"`
	Port    int    `json:"port,omitempty"`
}

type Log

type Log struct {
	Level     string `json:"level,omitempty"`
	Directory string `json:"directory,omitempty"`
	Format    string `json:"format,omitempty"`
}

type MatchedPrimaryPort

type MatchedPrimaryPort struct {
	Location        *Location `json:"location,omitempty"`
	ApplicationName string    `json:"application_name,omitempty"`
}

type ObjectMeta

type ObjectMeta struct {
	Name      string `json:"name,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

type PortName

type PortName string

type PreProcessFunc added in v0.0.14

type PreProcessFunc func([]byte) ([]byte, error)

type PrimaryPort

type PrimaryPort struct {
	Interface Interface `json:"interface,omitempty"`
	Location  *Location `json:"location,omitempty"`
}

type SecondaryPort

type SecondaryPort struct {
	Interface          Interface           `json:"interface,omitempty"`
	Options            KV                  `json:"options,omitempty"`
	MatchedPrimaryPort *MatchedPrimaryPort `json:"matched_primary_port,omitempty"`
}

type TypeMeta

type TypeMeta struct {
	Kind       string `json:"kind,omitempty"`
	APIVersion string `json:"api_version,omitempty"`
}

type Var added in v0.0.16

type Var struct {
	TmpDirectory     string `json:"tmp_directory,omitempty"`
	PrivateDirectory string `json:"private_directory,omitempty"`
}

func (*Var) GetPrivateDirectory added in v0.0.17

func (v *Var) GetPrivateDirectory() string

func (*Var) GetTmpDirectory added in v0.0.17

func (v *Var) GetTmpDirectory() string

Jump to

Keyboard shortcuts

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