config

package
v0.0.0-...-e075ff3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 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
		MaxRequestSize int    `yaml:"max_request_size" env:"MAX_REQUEST_SIZE"` // in mb, default 4mb
	} `yaml:"listen"`

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

	PostersConfig        PicturesConfig `yaml:"posters_config"`
	PreviewPostersConfig PicturesConfig `yaml:"preview_posters_config"`
	BackgroundConfig     PicturesConfig `yaml:"background_config"`
	KafkaConfig          struct {
		Brokers []string `yaml:"brokers"`
	} `yaml:"kafka"`
	ImageProcessingService struct {
		Addr         string                 `yaml:"addr" env:"IMAGE_PROCESSING_SERVICE_ADDRESS"`
		SecureConfig ConnectionSecureConfig `yaml:"secure_config"`
	} `yaml:"image_processing_service"`

	ImageStorageService struct {
		BasePictureUrl string                 `yaml:"base_picture_url" env:"BASE_PICTURE_URL"`
		Addr           string                 `yaml:"addr" env:"IMAGE_STORAGE_SERVICE_ADDRESS"`
		SecureConfig   ConnectionSecureConfig `yaml:"secure_config"`
	} `yaml:"image_storage_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"
	NilTlsConfig             DialMethod = "NIL_TLS_CONFIG"
	ClientWithSystemCertPool DialMethod = "CLIENT_WITH_SYSTEM_CERT_POOL"
	Server                   DialMethod = "SERVER"
)

type PicturesConfig

type PicturesConfig struct {
	ValidateImage bool `yaml:"validate_image"`
	CheckImage    struct {
		MaxImageWidth  int32    `yaml:"max_image_height"`
		MaxImageHeight int32    `yaml:"max_image_width"`
		MinImageWidth  int32    `yaml:"min_image_width"`
		MinImageHeight int32    `yaml:"min_image_height"`
		AllowedTypes   []string `yaml:"allowed_types"`
	} `yaml:"check_image"`
	ResizeImage           bool `yaml:"resize_image"`
	ImageProcessingConfig struct {
		ImageHeight       int32  `yaml:"image_height"`
		ImageWidth        int32  `yaml:"image_width"`
		ImageResizeMethod string `yaml:"resize_method"`
	} `yaml:"image_processing"`
	Category string `yaml:"category"`
}

Jump to

Keyboard shortcuts

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