config

package
v1.52.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(config Config)

ValidateConfig ValidateConfig.

Types

type AboutConfig

type AboutConfig struct {
	Developer      string `yaml:"developer"        mapstructure:"developer"`
	FrTranslator   string `yaml:"fr-translator"    mapstructure:"fr-translator"`
	ZhTranslator   string `yaml:"zh-translator"    mapstructure:"zh-translator"`
	BeTranslator   string `yaml:"be-translator"    mapstructure:"be-translator"`
	PtBrTranslator string `yaml:"pt-br-translator" mapstructure:"pt-br-translator"`
}

type Config

type Config struct {
	GinMode string `yaml:"gin-mode"            mapstructure:"gin-mode"`
	GRPC    struct {
		Listen string `mapstructure:"listen"`
	} `yaml:"grpc"            mapstructure:"grpc"`
	PublicRest         RestConfig                `yaml:"public-rest"         mapstructure:"public-rest"`
	DuplicateFinder    DuplicateFinderConfig     `yaml:"duplicate_finder"    mapstructure:"duplicate_finder"`
	AutowpDSN          string                    `yaml:"autowp-dsn"          mapstructure:"autowp-dsn"`
	AutowpMigrations   MigrationsConfig          `yaml:"autowp-migrations"   mapstructure:"autowp-migrations"`
	Sentry             SentryConfig              `yaml:"sentry"              mapstructure:"sentry"`
	FileStorage        FileStorageConfig         `yaml:"file_storage"        mapstructure:"file_storage"`
	RabbitMQ           string                    `yaml:"rabbitmq"            mapstructure:"rabbitmq"`
	MonitoringQueue    string                    `yaml:"monitoring_queue"    mapstructure:"monitoring_queue"`
	PrivateRest        RestConfig                `yaml:"private-rest"        mapstructure:"private-rest"`
	Telegram           TelegramConfig            `yaml:"telegram"            mapstructure:"telegram"`
	PostgresDSN        string                    `yaml:"postgres-dsn"        mapstructure:"postgres-dsn"`
	PostgresMigrations MigrationsConfig          `yaml:"postgres-migrations" mapstructure:"postgres-migrations"`
	Recaptcha          RecaptchaConfig           `yaml:"recaptcha"           mapstructure:"recaptcha"`
	MockEmailSender    bool                      `yaml:"mock-email-sender"   mapstructure:"mock-email-sender"`
	SMTP               SMTPConfig                `yaml:"smtp"                mapstructure:"smtp"`
	Feedback           FeedbackConfig            `yaml:"feedback"            mapstructure:"feedback"`
	Keycloak           KeycloakConfig            `yaml:"keycloak"            mapstructure:"keycloak"`
	UsersSalt          string                    `yaml:"users-salt"          mapstructure:"users-salt"`
	EmailSalt          string                    `yaml:"email-salt"          mapstructure:"email-salt"`
	Languages          map[string]LanguageConfig `yaml:"languages"           mapstructure:"languages"`
	Captcha            bool                      `yaml:"captcha"             mapstructure:"captcha"`
	ImageStorage       ImageStorageConfig        `yaml:"image-storage"       mapstructure:"image-storage"`
	Redis              string                    `yaml:"redis"               mapstructure:"redis"`
	DonationsVodPrice  int32                     `yaml:"donations-vod-price" mapstructure:"donations-vod-price"`
	About              AboutConfig               `yaml:"about"               mapstructure:"about"`
	ContentLanguages   []string                  `yaml:"content-languages"   mapstructure:"content-languages"`
	MessageInterval    int64                     `yaml:"message-interval"    mapstructure:"message-interval"`
}

Config Application config definition.

func LoadConfig

func LoadConfig(path string) Config

LoadConfig LoadConfig.

type DuplicateFinderConfig

type DuplicateFinderConfig struct {
	RabbitMQ string `yaml:"rabbitmq" mapstructure:"rabbitmq"`
	Queue    string `yaml:"queue"    mapstructure:"queue"`
}

DuplicateFinderConfig DuplicateFinderConfig.

type FeedbackConfig

type FeedbackConfig struct {
	From    string   `yaml:"from"    mapstructure:"from"`
	To      []string `yaml:"to"      mapstructure:"to"`
	Subject string   `yaml:"subject" mapstructure:"subject"`
}

FeedbackConfig FeedbackConfig.

type FileStorageConfig

type FileStorageConfig struct {
	S3     S3Config `yaml:"s3"     mapstructure:"s3"`
	Bucket string   `yaml:"bucket" mapstructure:"bucket"`
}

FileStorageConfig FileStorageConfig.

type FitType

type FitType int
const (
	FitTypeInner   FitType = 0
	FitTypeOuter   FitType = 1
	FitTypeMaximum FitType = 2
)

type ImageStorageConfig

type ImageStorageConfig struct {
	Dirs    map[string]ImageStorageDirConfig           `mapstructure:"dirs"`
	Formats map[string]ImageStorageSamplerFormatConfig `mapstructure:"formats"`
	S3      struct {
		Region      string `mapstructure:"region"`
		Endpoint    string `mapstructure:"endpoint"`
		Credentials struct {
			Key    string `mapstructure:"key"`
			Secret string `mapstructure:"secret"`
		} `mapstructure:"credentials"`
		UsePathStyleEndpoint bool `mapstructure:"use_path_style_endpoint"`
	} `mapstructure:"s3"`
	SrcOverride struct {
		Host   string `mapstructure:"host"`
		Scheme string `mapstructure:"scheme"`
	} `mapstructure:"src-override"`
}

type ImageStorageDirConfig

type ImageStorageDirConfig struct {
	NamingStrategy ImageStorageNamingStrategyConfig `mapstructure:"naming-strategy"`
	Bucket         string                           `mapstructure:"bucket"`
}

type ImageStorageNamingStrategyConfig

type ImageStorageNamingStrategyConfig struct {
	Strategy string `mapstructure:"strategy"`
	Options  struct {
		Deep int `mapstructure:"deep"`
	} `mapstructure:"options"`
}

type ImageStorageSamplerFormatConfig

type ImageStorageSamplerFormatConfig struct {
	FitType          FitType `mapstructure:"fit-type"`
	Width            int     `mapstructure:"width"`
	Height           int     `mapstructure:"height"`
	Background       string  `mapstructure:"background"`
	Strip            bool    `mapstructure:"strip"`
	ReduceOnly       bool    `mapstructure:"reduce-only"`
	ProportionalCrop bool    `mapstructure:"proportional-crop"`
	Format           string  `mapstructure:"format"`
	IgnoreCrop       bool    `mapstructure:"ignore-crop"`
	Widest           float64 `mapstructure:"widest"`
	Highest          float64 `mapstructure:"highest"`
}

type KeycloakConfig

type KeycloakConfig struct {
	URL          string `yaml:"url"           mapstructure:"url"`
	ClientID     string `yaml:"client-id"     mapstructure:"client-id"`
	ClientSecret string `yaml:"client-secret" mapstructure:"client-secret"`
	Realm        string `yaml:"realm"         mapstructure:"realm"`
}

KeycloakConfig KeycloakConfig.

type LanguageConfig

type LanguageConfig struct {
	Hostname string   `yaml:"hostname" mapstructure:"hostname"`
	Timezone string   `yaml:"timezone" mapstructure:"timezone"`
	Name     string   `yaml:"name"     mapstructure:"name"`
	Flag     string   `yaml:"flag"     mapstructure:"flag"`
	Aliases  []string `yaml:"aliases"  mapstructure:"aliases"`
}

LanguageConfig LanguageConfig.

type MigrationsConfig

type MigrationsConfig struct {
	DSN string `yaml:"dsn" mapstructure:"dsn"`
	Dir string `yaml:"dir" mapstructure:"dir"`
}

MigrationsConfig MigrationsConfig.

type RecaptchaConfig

type RecaptchaConfig struct {
	PublicKey  string `yaml:"public-key"  mapstructure:"public-key"`
	PrivateKey string `yaml:"private-key" mapstructure:"private-key"`
}

RecaptchaConfig RecaptchaConfig.

type RestConfig

type RestConfig struct {
	Listen string         `mapstructure:"listen"`
	Cors   RestCorsConfig `mapstructure:"cors"`
}

RestConfig RestConfig.

type RestCorsConfig

type RestCorsConfig struct {
	Origin []string `mapstructure:"origin"`
}

RestCorsConfig RestCorsConfig.

type S3Config

type S3Config struct {
	Credentials      S3CredentialsConfig `yaml:"credentials"         mapstructure:"credentials"`
	Region           string              `yaml:"region"              mapstructure:"region"`
	Endpoints        []string            `yaml:"endpoints"           mapstructure:"endpoints"`
	S3ForcePathStyle bool                `yaml:"s3_force_path_style" mapstructure:"s3_force_path_style"`
}

S3Config S3Config.

type S3CredentialsConfig

type S3CredentialsConfig struct {
	Key    string `yaml:"key"    mapstructure:"key"`
	Secret string `yaml:"secret" mapstructure:"secret"`
}

S3CredentialsConfig S3CredentialsConfig.

type SMTPConfig

type SMTPConfig struct {
	Hostname string `yaml:"hostname" mapstructure:"hostname"`
	Port     int    `yaml:"port"     mapstructure:"port"`
	Username string `yaml:"username" mapstructure:"username"`
	Password string `yaml:"password" mapstructure:"password"`
}

SMTPConfig SMTPConfig.

type SentryConfig

type SentryConfig struct {
	DSN         string `yaml:"dsn"         mapstructure:"dsn"`
	Environment string `yaml:"environment" mapstructure:"environment"`
}

SentryConfig SentryConfig.

type TelegramConfig

type TelegramConfig struct {
	AccessToken string `yaml:"access-token" mapstructure:"access-token"`
}

Jump to

Keyboard shortcuts

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