config

package
v0.0.0-...-8f9ce2e Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfiguration

func LoadConfiguration(conf string, c interface{}) error

func LoadConfigurationFromFile

func LoadConfigurationFromFile(path string, c interface{}) error

func LoadConfigurationFromString

func LoadConfigurationFromString(conf string, c interface{}) error

Types

type Api

type Api struct {
	Prefix string `toml:"prefix"`
}

type Config

type Config struct {
	Name       string               `toml:"name"`
	Databases  map[string]*Database `toml:"databases"`
	Filesystem Filesystem           `toml:"filesystem"`
	Test       bool                 `toml:"test"`
	Bind       string               `toml:"bind"`
	Guard      *Guard               `toml:"guard"`
	Security   *Security            `toml:"security"`
	Search     *Search              `toml:"search"`
	Media      *Media               `toml:"media"`
	Logger     *Logger              `toml:"logger"`
	Api        *Api                 `toml:"api"`
	Dashboard  *Dashboard           `toml:"dashboard"`
}

func NewConfig

func NewConfig() *Config

type Dashboard

type Dashboard struct {
	Prefix string `toml:"prefix"`
}

type Database

type Database struct {
	Name    string `toml:"name"`
	DSN     string `toml:"dsn"`
	Type    string `toml:"type"`
	Prefix  string `toml:"prefix"`
	Enabled bool   `toml:"enabled"`
}

type Filesystem

type Filesystem struct {
	Type string `toml:"type"`
	Path string `toml:"path"`
}

type Guard

type Guard struct {
	Key string `toml:"key"`
	Jwt struct {
		Validity int64 `toml:"validity"`
		Login    struct {
			EndPoint string `toml:"endpoint"`
			Page     string `toml:"page"`
		} `toml:"login"`
		Token struct {
			Apply  string   `toml:"apply"`
			Ignore []string `toml:"ignore"`
		} `toml:"token"`
	} `toml:"jwt"`
	Anonymous struct {
		Roles []string `toml:"roles"`
	}
}

type Handler

type Handler struct {
	Type    string `toml:"type"`
	Enabled bool   `toml:"enabled"`
}

type Logger

type Logger struct {
	Level  string                            `toml:"level"`
	Fields map[string]string                 `toml:"fields"`
	Hooks  map[string]map[string]interface{} `toml:"hooks"`
}

type Media

type Media struct {
	Image *MediaImage `toml:"image"`
}

type MediaImage

type MediaImage struct {
	AllowedWidths []uint `toml:"allowed_widths"`
	MaxWidth      uint   `toml:"max_width"`
}
type Search struct {
	MaxResult uint64 `toml:"max_result"`
}

type Security

type Security struct {
	Cors struct {
		AllowedOrigins     []string `toml:"allowed_origins"`
		AllowedMethods     []string `toml:"allowed_methods"`
		AllowedHeaders     []string `toml:"allowed_headers"`
		ExposedHeaders     []string `toml:"exposed_headers"`
		AllowCredentials   bool     `toml:"allow_credentials"`
		MaxAge             int      `toml:"max_age"`
		OptionsPassthrough bool     `toml:"options_passthrough"`
		Debug              bool     `toml:"debug"`
	} `toml:"cors"`
	Access []*struct {
		Path  string   `toml:"path"`
		Roles []string `toml:"roles"`
	} `toml:"access"`
	Voters []string `toml:"voters"`
}

Jump to

Keyboard shortcuts

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