config

package
v0.0.0-...-f5f0fde Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 11 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
		AllowedHeaders []string `yaml:"allowed_headers"`
	} `yaml:"listen"`

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

	DbConnectionString string        `yaml:"db_connection_string" env:"DB_CONNECTION_STRING"`
	DbName             string        `yaml:"db_name" env:"DB_NAME"`
	JaegerConfig       jaeger.Config `yaml:"jaeger"`
	ReserveCache       struct {
		Network  string `yaml:"network" env:"RESERVE_CACHE_NETWORK"`
		Addr     string `yaml:"addr" env:"RESERVE_CACHE_ADDR"`
		DB       int    `yaml:"db" env:"RESERVE_CACHE_DB"`
		Password string `yaml:"password" env:"RESERVE_CACHE_PASSWORD"`
	} `yaml:"reserve_cache"`

	SeatReservationTime time.Duration `yaml:"seat_reservation_time"`

	CinemaServiceConfig struct {
		Addr         string                 `yaml:"addr" env:"CINEMA_SERVICE_ADDR"`
		SecureConfig ConnectionSecureConfig `yaml:"secure_config"`
	} `yaml:"cinema_service"`

	ProfilesServiceConfig struct {
		Addr         string                 `yaml:"addr" env:"PROFILES_SERVICE_ADDR"`
		SecureConfig ConnectionSecureConfig `yaml:"secure_config"`
	} `yaml:"profiles_service"`

	PaymentServiceConfig struct {
		Paymenturl       string        `yaml:"payment_url" env:"PAYMENT_URL"`
		PaymentSleepTime time.Duration `yaml:"payment_sleep_time"`
		RefundSleepTime  time.Duration `yaml:"refund_sleep_time"`
	} `yaml:"payment_service"`

	OrdersEventsConfig struct {
		Brokers []string `yaml:"brokers"`
	} `yaml:"orders_events"`
}

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"`
	CertName   string `yaml:"cert_name"`
	KeyName    string `yaml:"key_name"`
}

func (ConnectionSecureConfig) GetGrpcTransportCredentials

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

type DialMethod

type DialMethod = string
const (
	Insecure                 DialMethod = "INSECURE"
	NilTlsConfig             DialMethod = "NIL_TLS_CONFIG"
	ClientWithSystemCertPool DialMethod = "CLIENT_WITH_SYSTEM_CERT_POOL"
	Server                   DialMethod = "SERVER"
)

Jump to

Keyboard shortcuts

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