config

package
v0.0.0-...-abe6acf Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LogLevel        string `yaml:"log_level" env:"LOG_LEVEL"`
	HealthcheckPort string `yaml:"healthcheck_port" env:"HEALTHCHECK_PORT"`

	Listen struct {
		Host string `yaml:"host" env:"HOST"`
		Port string `yaml:"port" env:"PORT"`
		Mode string `yaml:"server_mode" env:"SERVER_MODE"` // support GRPC, REST, BOTH
	} `yaml:"listen"`

	PrometheusConfig struct {
		Name         string                      `yaml:"service_name" ENV:"PROMETHEUS_SERVICE_NAME"`
		ServerConfig metrics.MetricsServerConfig `yaml:"server_config"`
	} `yaml:"prometheus"`

	DBConfig     repository.DBConfig `yaml:"db_config"`
	JaegerConfig jaeger.Config       `yaml:"jaeger"`

	KafkaEventsConfig KafkaReaderConfig `yaml:"kafka_events_config"`

	MoviesService struct {
		Addr             string                 `yaml:"addr" env:"MOVIES_SERVICE_ADDRESS"`
		ConnectionConfig ConnectionSecureConfig `yaml:"connection_config"`
	} `yaml:"movies_service"`
	MoviesPersonsService struct {
		Addr             string                 `yaml:"addr" env:"MOVIES_PERSONS_SERVICE_ADDRESS"`
		ConnectionConfig ConnectionSecureConfig `yaml:"connection_config"`
	} `yaml:"movies_persons_service"`
}

func GetConfig

func GetConfig() *Config

type ConnectionSecureConfig

type ConnectionSecureConfig struct {
	Method DialMethod `yaml:"dial_method"`
	// Only for client connection with system pool
	ServerName string `yaml:"server_name"`
}

func (ConnectionSecureConfig) GetGrpcTransportCredentials

func (c ConnectionSecureConfig) GetGrpcTransportCredentials() (grpc.DialOption, error)

type DialMethod

type DialMethod = string
const (
	Insecure                 DialMethod = "INSECURE"
	InsecureSkipVerify       DialMethod = "INSECURE_SKIP_VERIFY"
	ClientWithSystemCertPool DialMethod = "CLIENT_WITH_SYSTEM_CERT_POOL"
)

type KafkaReaderConfig

type KafkaReaderConfig struct {
	Brokers          []string      `yaml:"brokers"`
	GroupID          string        `yaml:"group_id"`
	ReadBatchTimeout time.Duration `yaml:"read_batch_timeout"`
}

Jump to

Keyboard shortcuts

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