config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateStorageConfigProvider

func ValidateStorageConfigProvider(fl validator.FieldLevel) bool

Types

type AuthConfig

type AuthConfig struct {
	OIDC OIDCConfig `json:"oidc" yaml:"oidc"`
}

func (AuthConfig) StructPath

func (a AuthConfig) StructPath() string

type DatabaseConfig

type DatabaseConfig struct {
	ConnectionString string `validate:"required" json:"connectionString" yaml:"connectionString"`
}

func (DatabaseConfig) StructPath

func (d DatabaseConfig) StructPath() string

type GeneralConfig

type GeneralConfig struct {
	LogLevel  string `` /* 186-byte string literal not displayed */
	LogFormat string `default:"pretty" usage:"pretty, json" validate:"omitempty,oneof=pretty json" json:"logFormat" yaml:"logFormat"`
}

func (GeneralConfig) StructPath

func (g GeneralConfig) StructPath() string

type OIDCConfig

type OIDCConfig struct {
	Provider    string `validate:"required,url" json:"provider" yaml:"provider"`
	ClientID    string `validate:"required" json:"clientID" yaml:"clientID"`
	ScopePrefix string `json:"scopePrefix" yaml:"scopePrefix"`
}

func (OIDCConfig) StructPath

func (O OIDCConfig) StructPath() string

type Root

type Root struct {
	Auth     AuthConfig     `json:"auth" yaml:"auth"`
	Database DatabaseConfig `json:"database" yaml:"database"`
	General  GeneralConfig  `json:"general" yaml:"general"`
	Server   ServerConfig   `json:"server" yaml:"server"`
	Storage  StorageConfig  `json:"storage" yaml:"storage"`
}

func GenerateDefault

func GenerateDefault() (Root, error)

func (Root) StructPath

func (r Root) StructPath() string

func (Root) Validate

func (r Root) Validate(filters ...string) error

type Section

type Section interface {
	StructPath() string
}

type ServerConfig

type ServerConfig struct {
	Port              uint `default:"8080" validate:"omitempty,gt=0,lte=65535" json:"port" yaml:"port"`
	TrustedProxyCount uint `default:"0" json:"trustedProxyCount" yaml:"trustedProxyCount"`
}

func (ServerConfig) StructPath

func (s ServerConfig) StructPath() string

type StorageConfig

type StorageConfig struct {
	Provider string             `default:"local" usage:"local, s3" validate:"required,oneof=local s3,storage_provider" json:"provider" yaml:"provider"`
	Local    StorageLocalConfig `json:"local" yaml:"local"`
	S3       StorageS3Config    `json:"s3" yaml:"s3"`
}

func (StorageConfig) StructPath

func (s StorageConfig) StructPath() string

type StorageLocalConfig

type StorageLocalConfig struct {
	Path string `default:"/var/lib/yafus/files" json:"path" yaml:"path"` // validated with ValidateStorageConfigProvider
}

func (StorageLocalConfig) StructPath

func (s StorageLocalConfig) StructPath() string

type StorageS3Config

type StorageS3Config struct {
	Endpoint            string `json:"endpoint" yaml:"endpoint"` // validated with ValidateStorageConfigProvider
	UseTLS              bool   `default:"true" json:"useTLS" yaml:"useTLS"`
	SkipTLSVerification bool   `default:"false" json:"SkipTLSVerification" yaml:"SkipTLSVerification"`
	Region              string `json:"region" yaml:"region"`
	Bucket              string `validate:"required_with=Endpoint" json:"bucket" yaml:"bucket"`
	Path                string `default:"/" validate:"required_with=Endpoint" json:"path" yaml:"path"`
	AccessKeyID         string `validate:"required_with=Endpoint" json:"accessKeyID" yaml:"accessKeyID"`
	SecretAccessKey     string `validate:"required_with=Endpoint" json:"secretAccessKey" yaml:"secretAccessKey"`
}

func (StorageS3Config) StructPath

func (s StorageS3Config) StructPath() string

Jump to

Keyboard shortcuts

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