config

package
v0.0.0-...-d9bd7fb Latest Latest
Warning

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

Go to latest
Published: Mar 13, 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"`
	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"`               // Need for REST API gateway, list of metadata headers
	} `yaml:"listen"`

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

	AccountEventsConfig KafkaReaderConfig `yaml:"account_events"`
	ImageStorageService struct {
		Addr                         string                 `yaml:"addr" env:"IMAGE_STORAGE_ADDRESS"`
		SecureConfig                 ConnectionSecureConfig `yaml:"secure_config"`
		BaseProfilePictureURL        string                 `yaml:"base_profile_picture_url" env:"BASE_PROFILE_PICTURE_URL"`
		ProfilePictureCategory       string                 `yaml:"profile_picture_category" env:"PROFILE_PICTURE_CATEGORY"`
		CheckProfilePictureExistance bool                   `yaml:"check_profile_picture_existence" env:"CHECK_PROFILE_PICTURE_EXISTENCE"`
	} `yaml:"image_storage_service"`
	ImageProcessingService struct {
		Addr                 string                 `yaml:"addr" env:"IMAGE_PROCESSING_ADDRESS"`
		SecureConfig         ConnectionSecureConfig `yaml:"secure_config"`
		ImageResizeMethod    string                 `yaml:"resize_type" env:"RESIZE_TYPE"`
		ProfilePictureHeight int32                  `yaml:"profile_picture_height" env:"PROFILE_PICTURE_HEIGHT"`
		ProfilePictureWidth  int32                  `yaml:"profile_picture_width" env:"PROFILE_PICTURE_WIDTH"`
		AllowedTypes         []string               `yaml:"allowed_types"`
		MaxImageWidth        int32                  `yaml:"max_image_width" env:"MAX_IMAGE_WIDTH"`
		MaxImageHeight       int32                  `yaml:"max_image_height" env:"MAX_IMAGE_HEIGHT"`
		MinImageWidth        int32                  `yaml:"min_image_width" env:"MIN_IMAGE_WIDTH"`
		MinImageHeight       int32                  `yaml:"min_image_height" env:"MIN_IMAGE_HEIGHT"`
	} `yaml:"image_processing_service"`

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

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