config

package
v0.0.0-...-2119b44 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MPL-2.0 Imports: 10 Imported by: 58

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAuthKey

func LoadAuthKey() string

func LoadConfig

func LoadConfig(configFileName string, config interface{})

LoadConfig loads configuration into `config` object Pulls configuration from env vars and config file Config should be a yaml file with `configFileName` and 'yaml' extension for example: `.registry` Available paths: $HOME, same as binary ENV vars have precedence configFileName - name of config file without extension. Config file should have yaml format and property Names should start with lowercase latter Evn var should be uppercased

Types

type Auth

type Auth struct {
	AuthServerUrl  string `default:"http://localhost:4434"`
	AuthAppUrl     string `default:"http://localhost:4455"`
	AuthAPIGW      string `default:"http://localhost:8080"`
	BypassAuthMode bool   `default:"false"`
	KetoUrl        string `default:"http://localhost:4466"`
}

func LoadAuthHostConfig

func LoadAuthHostConfig(name string) *Auth

type BaseConfig

type BaseConfig struct {
	DebugMode bool
}

Common properties for all configs. Don't forget to use `mapstructure:",squash"`. See unittest for example

type Database

type Database struct {
	Host       string `default:"localhost"`
	Password   string `default:"Pass2020!"`
	DbName     string
	Username   string `default:"postgres"`
	SslEnabled bool   `default:"false"`
	Port       int    `default:"5432"`
}

func DefaultDatabaseName

func DefaultDatabaseName(name string) Database

func (Database) ChangeDbName

func (p Database) ChangeDbName(name string) sql.DbConfig

func (Database) GetConnString

func (p Database) GetConnString() string

func (Database) GetDbName

func (p Database) GetDbName() string

type Forward

type Forward struct {
	Ip   string `json:"ip"`
	Port int    `json:"port"`
	Path string `json:"default_path"`
}

Service would be listing on this IP and Port for incoming messages

func DefaultForwardConfig

func DefaultForwardConfig() Forward

type Grpc

type Grpc struct {
	Port int `default:"9090"`
}

type GrpcService

type GrpcService struct {
	Host    string        `default:"localhost:9090"`
	Timeout time.Duration `default:"3s"`
}

type Metrics

type Metrics struct {
	Port    int  `default:"10250"`
	Enabled bool `default:"true"`
}

func DefaultMetrics

func DefaultMetrics() *Metrics

type MsgClient

type MsgClient struct {
	Host           string        `default:"localhost:9095"`
	Timeout        time.Duration `default:"3s"`
	RetryCount     int8          `default:"3"`
	Exchange       string        `default:"amq.topic"`
	ListenQueue    string        `default:""`
	PublishQueue   string        `default:""`
	ListenerRoutes []string
}

Message Client for a system which talks to MsgBus

type Pattern

type Pattern struct {
	Routes []Route
}

Service would a have some finite number of routes thorugh which it could be reached.

type Queue

type Queue struct {
	Uri string `default:"amqp://guest:guest@localhost:5672"` // Env var name: QUEUE_URI or in file Queue: { Uri: "" }. Example: QUEUE_URI=amqp://guest:guest@localhost:5672/
}

Messaging systems URI

func (*Queue) SafeString

func (q *Queue) SafeString() string

SafeString returns URI without password for logging purpose

type Route

type Route map[string]string

Route are key value pair

type Service

type Service struct {
	Host string `default:"localhost"`
	Port string `default:"9090"`
	Uri  string `default:"localhost:9090"`
}

func LoadServiceHostConfig

func LoadServiceHostConfig(name string) *Service

type ServiceApiIf

type ServiceApiIf struct {
	Name string  `json:"name"`
	P    []Route `json:"patterns"`
	F    Forward `json:"forward"`
}

Service API interface is registered to Router service. So that Router service know when and where to reach service.

Jump to

Keyboard shortcuts

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