config

package
v0.0.0-...-66c7a0d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SERVICE_NAME = "config-mgmt-service"

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	URI          string `mapstructure:"uri"`
	Database     string `mapstructure:"database"`
	SchemaPath   string `mapstructure:"schema_path"`
	MaxOpenConns int    `mapstructure:"max_open_conns"`
	MaxIdleConns int    `mapstructure:"max_idle_conns"`
}

type Service

type Service struct {
	Name     string `json:"name" mapstructure:"name"`
	Version  string `json:"version" mapstructure:"version"`
	Host     string `json:"host" mapstructure:"host"`
	Port     int    `json:"port" mapstructure:"port"`
	LogLevel string `json:"log_level" mapstructure:"log_level"`
	Postgres `json:"postgres" mapstructure:"postgres"`

	TLSConfig certs.TLSConfig `mapstructure:"tls"`
	// contains filtered or unexported fields
}

Service config definition

func ConfigFromViper

func ConfigFromViper() (*Service, error)

ConfigFromViper returns a Service instance from the current viper config

func Default

func Default() *Service

Default returns a blank Service instance with default parameters

func New

func New(b backend.Client) *Service

New returns a Service instance with default parameters and backend client

func (*Service) GetBackend

func (s *Service) GetBackend() backend.Client

Returns the configured backend

func (*Service) GetServiceCerts

func (s *Service) GetServiceCerts() *certs.ServiceCerts

func (*Service) ListenAddress

func (c *Service) ListenAddress() string

ListenAddress is the address where gRPC server will bind and listen

func (*Service) SetBackend

func (s *Service) SetBackend(b backend.Client)

func (*Service) SetLogLevel

func (c *Service) SetLogLevel()

SetLogLevel sets the log level for the service

Jump to

Keyboard shortcuts

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