config

package
v0.0.0-...-ca83fcd Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Servicename = "cel-service"

Variables

View Source
var DefaultConfig = Config{
	Port:       8000,
	Sslport:    8443,
	ServiceURL: "https://127.0.0.1:8443",
	SecretFile: "",
	Apikey:     false,
	HealthCheck: HealthCheck{
		Period: 30,
	},
	Logging: LoggingConfig{
		Level:    "INFO",
		Filename: "${configdir}/logging.log",
	},
}
View Source
var File = "${configdir}/service.yaml"

File the config file

Functions

func GetConfigValueAsBool

func GetConfigValueAsBool(properties map[string]interface{}, key string) (bool, error)

func GetConfigValueAsInt

func GetConfigValueAsInt(properties map[string]interface{}, key string) (int64, error)

func GetConfigValueAsString

func GetConfigValueAsString(properties map[string]interface{}, key string) (string, error)

func GetDefaultConfigFolder

func GetDefaultConfigFolder() (string, error)

GetDefaultConfigFolder returning the default configuration folder of the system

func Load

func Load() error

Load loads the config

func ReplaceConfigdir

func ReplaceConfigdir(s string) (string, error)

Types

type Authentcation

type Authentcation struct {
	Type       string                 `yaml:"type"`
	Properties map[string]interface{} `yaml:"properties"`
}

type Config

type Config struct {
	//port of the http server
	Port int `yaml:"port"`
	//port of the https server
	Sslport int `yaml:"sslport"`
	// Enable ssl
	GRPCTSL bool `yaml:"grpctsl"`
	//port of the http server
	GRPCPort int `yaml:"grpcport"`
	//this is the url how to connect to this service from outside
	ServiceURL string `yaml:"serviceURL"`

	SecretFile string `yaml:"secretfile"`
	Apikey     bool   `yaml:"apikey"`

	Logging LoggingConfig `yaml:"logging"`

	HealthCheck HealthCheck `yaml:"healthcheck"`

	Auth Authentcation `yaml:"auth"`

	OpenTracing OpenTracing `yaml:"opentracing"`

	Metrics Metrics `yaml:"metrics"`
}

Config our service configuration

func Get

func Get() Config

Get returns loaded config

type HealthCheck

type HealthCheck struct {
	Period int `yaml:"period"`
}

HealthCheck configuration for the health check system

type LoggingConfig

type LoggingConfig struct {
	Level    string `yaml:"level"`
	Filename string `yaml:"filename"`

	Gelfurl  string `yaml:"gelf-url"`
	Gelfport int    `yaml:"gelf-port"`
}

Logging configuration for the gelf logging

type Metrics

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

type OpenTracing

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

type Secret

type Secret struct {
	MongoDB struct {
		Username string `yaml:"username"`
		Password string `yaml:"password"`
	} `yaml:"mongodb"`
}

Secret our service configuration

type Version

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

func ParseVersion

func ParseVersion(versionStr string) (Version, error)

func (*Version) IsEqual

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

func (*Version) IsGreaterThan

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

func (*Version) IsSmallerThan

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

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