config

package
v0.0.0-...-9811130 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Servicename = "go-micro"

Servicename the name of this service

Variables

View Source
var DefaultConfig = Config{
	HTTP: shttp.Config{
		Servicename: "go-micro",
		Port:        8000,
		Sslport:     8443,
		ServiceURL:  "https://127.0.0.1:8443",
	},
	HealthSystem: health.Config{
		Period:     30,
		StartDelay: 3,
	},
	SecretFile: "",
	Logging: logging.Config{
		Level:    "INFO",
		Filename: "${configdir}/logging.log",
	},
}

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 Config

type Config struct {
	// all secrets will be stored in this file, same structure as the main config file
	SecretFile string `yaml:"secretfile"`
	// configure logging to gelf logging system
	Logging logging.Config `yaml:"logging"`
	// use authentication via jwt
	Auth Authentication `yaml:"auth"`
	// opentelemtrie tracer can be configured here
	OpenTracing OpenTracing `yaml:"opentracing"`
	// and some metrics
	Metrics Metrics `yaml:"metrics"`
	// HTTP REST Service
	HTTP shttp.Config `yaml:"http"`
	// special config for health checks
	HealthSystem health.Config `yaml:"healthcheck"`
	// CA service will be used, microvault
	CA caservice.Config `yaml:"ca"`
	// Enable Profiling option
	Profiling Profiling `yaml:"profiling"`
	// This is the demo address storage config
	AddressStorage adrsvc.Config `yaml:"addressstorage"`
}

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 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 Profiling

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

Profiling 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