config

package
v0.0.0-...-ca3ac9b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DoServiceConfig = "service_config"

DoServiceConfig the name of the injected config

View Source
const Servicename = "goblob-service"

Servicename the name of this service

Variables

View Source
var DefaultConfig = Config{
	Service: Service{
		HTTP: HTTP{
			Port:       8000,
			Sslport:    8443,
			ServiceURL: "https://127.0.0.1:8443",
		},
		HealthSystem: health.Config{
			Period:     30,
			StartDelay: 3,
		},
	},
	Apikey:     true,
	SecretFile: "",
	Logging: logging.LoggingConfig{
		Level:    "INFO",
		Filename: "${configdir}/logging.log",
	},
	Engine: Engine{
		RetentionManager: "SingleRetention",
		Tenantautoadd:    true,
		BackupSyncmode:   false,
		Storage: Storage{
			Storageclass: "SimpleFile",
			Properties: map[string]any{
				"rootpath": "./blbstg",
			},
		},
	},
	HeaderMapping: defaultHeaderMapping,
}

DefaultConfig default configuration

View Source
var File = "${configdir}/service.yaml"

File the config file

Functions

func GetConfigValueAsBool

func GetConfigValueAsBool(properties map[string]any, key string) (bool, error)

GetConfigValueAsBool getting a value as a bool, if possible

func GetConfigValueAsInt

func GetConfigValueAsInt(properties map[string]any, key string) (int64, error)

GetConfigValueAsInt getting a value as a int64, if possible

func GetConfigValueAsString

func GetConfigValueAsString(properties map[string]any, key string) (string, error)

GetConfigValueAsString getting a value as a string, if possible

func GetDefaultConfigFolder

func GetDefaultConfigFolder() (string, error)

GetDefaultConfigFolder returning the default configuration folder of the system

func GetDefaultConfigfile

func GetDefaultConfigfile() (string, error)

GetDefaultConfigfile getting the default config file

func Load

func Load() error

Load loads the config

func ReplaceConfigdir

func ReplaceConfigdir(s string) (string, error)

ReplaceConfigdir replace the configdir macro

Types

type Authentication

type Authentication struct {
	Type       string         `yaml:"type"`
	Properties map[string]any `yaml:"properties"`
}

Authentication configuration

type CAService

type CAService struct {
	UseCA     bool   `yaml:"useca"`
	URL       string `yaml:"url"`
	AccessKey string `yaml:"accesskey"`
	Secret    string `yaml:"secret"`
}

CAService the micro-vault ca service config

type Config

type Config struct {
	// all secrets will be stored in this file, same structure as the main config file
	SecretFile string `yaml:"secretfile"`

	Apikey bool `yaml:"apikey"`
	// all configuration of internal services can be stored here
	Service Service `yaml:"service"`

	// configure logging to gelf logging system
	Logging logging.LoggingConfig `yaml:"logging"`

	Auth Authentication `yaml:"auth"`

	Engine Engine `yaml:"engine"`

	HeaderMapping map[string]string `yaml:"headermapping"`

	OpenTracing OpenTracing `yaml:"opentracing"`

	Metrics Metrics `yaml:"metrics"`
}

Config our service configuration

func Get

func Get() Config

Get returns loaded config

func (*Config) Provide

func (c *Config) Provide()

Provide provide the config to the dependency injection

type Engine

type Engine struct {
	RetentionManager string    `yaml:"retentionManager"`
	Tenantautoadd    bool      `yaml:"tenantautoadd"`
	BackupSyncmode   bool      `yaml:"backupsyncmode"`
	AllowTntBackup   bool      `yaml:"allowtntbackup"`
	Storage          Storage   `yaml:"storage"`
	Backup           Storage   `yaml:"backup"`
	Cache            Storage   `yaml:"cache"`
	Index            Storage   `yaml:"index"`
	Extractor        Extractor `yaml:"extractor"`
}

Engine configuration

type Extractor

type Extractor struct {
	Service    string         `yaml:"service"`
	Properties map[string]any `yaml:"properties"`
}

Extractor defining config for full text extraction services

type HTTP

type HTTP struct {
	// port of the http server
	Port int `yaml:"port"`
	// port of the https server
	Sslport int `yaml:"sslport"`
	// this is the url how to connect to this service from outside
	ServiceURL string `yaml:"serviceURL"`
	// other dns names (used for certificate)
	DNSNames []string `yaml:"dnss"`
	// other ips (used for certificate)
	IPAddresses []string `yaml:"ips"`
}

HTTP configuration of the http service

type Metrics

type Metrics struct {
	Enable bool `yaml:"enable"`
}

Metrics configuration

type OpenTracing

type OpenTracing struct {
	Host     string `yaml:"host"`
	Endpoint string `yaml:"endpoint"`
}

OpenTracing configuration

type Service

type Service struct {
	HTTP HTTP `yaml:"http"`
	// special config for health checks
	HealthSystem health.Config `yaml:"healthcheck"`
	// CA service will be used, microvault
	CA CAService `yaml:"ca"`
}

Service the configuration of services inside this ms

type Storage

type Storage struct {
	Storageclass string         `yaml:"storageclass"`
	Properties   map[string]any `yaml:"properties"`
}

Storage configuration

type Version

type Version struct {
	Major   int
	Minor   int
	Patch   int
	Special string
}

Version version struct

func ParseVersion

func ParseVersion(versionStr string) (Version, error)

ParseVersion parse a string into a version object

func (*Version) IsEqual

func (v *Version) IsEqual(o Version) bool

IsEqual validate if src version is equal than o

func (*Version) IsGreaterThan

func (v *Version) IsGreaterThan(o Version) bool

IsGreaterThan validate if src version is greater than o

func (*Version) IsSmallerThan

func (v *Version) IsSmallerThan(o Version) bool

IsSmallerThan validate if src version is smaller than o

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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