config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const StorageTypeFS = "fs"

Variables

This section is empty.

Functions

func BuildDSN

func BuildDSN(config Database, fallback Database) string

func ParseAllowedImageConfigs

func ParseAllowedImageConfigs(configs string) ([]imageproxy.ImageConfig, error)

Types

type AuthType

type AuthType string
const (
	AuthTypeNone AuthType = "NONE"
	AuthTypeOIDC AuthType = "OIDC"
)

type Config

type Config struct {
	Authentication struct {
		Type AuthType
		OIDC struct {
			IssuerURL    string
			ClientID     string
			ClientSecret string
		}
		SessionAuthKey [64]byte
		SessionEncKey  [32]byte
	}
	Database struct {
		Default Database
		Content Database
		Product Database
	}
	Features   Features
	ImageProxy struct {
		BaseURL string
		Key     string
		Salt    string

		// Comma-separated list of allowed configs in format width:height:resizingType.
		// Example "100:100:FILL,300:200:FIT". Use "*" if not limiting the configs.
		AllowedConfigs string
	}
	Server struct {
		Debug          bool
		Port           int
		TrustedProxies []string
	}
	Storage struct {
		Images Storage
	}
}

func ParseConfig

func ParseConfig() (*Config, error)

type Content

type Content struct {
	Name        string
	ContentType string
}

func (Content) ToEntity

func (c Content) ToEntity() entities.Content

type ContentList

type ContentList []Content

func (ContentList) ToEntity

func (cl ContentList) ToEntity() []entities.Content

type Database

type Database struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

type Feature

type Feature string
const (
	FeatureCategories    Feature = "Categories"
	FeatureManufacturers Feature = "Manufacturers"
	FeatureProducts      Feature = "Products"
	FeatureServices      Feature = "Services"
	FeatureContent       Feature = "Content"
	FeatureEvents        Feature = "Events"
)

type Features

type Features struct {
	StartpageFeature Feature
	Categories       struct {
		Enabled bool
	}
	Manufacturers struct {
		Enabled bool
	}
	Products struct {
		Enabled                 bool
		PublicURLTemplate       string
		PublicURLTemplateParsed *template.Template
		ShortDescriptionOnly    bool
	}
	Services struct {
		Enabled bool
	}

	Content struct {
		Enabled bool
		List    ContentList
	}
	Events struct {
		Enabled       bool
		WholeDaysOnly bool
	}
}

type Storage

type Storage struct {
	Type string
	Path string
}

Jump to

Keyboard shortcuts

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