config

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnConfigChange added in v1.1.0

func OnConfigChange(callback OnConfigChangeFunc)

OnConfigChange can be used to attach a callback function which is called whenever the config changes

func PathUsed added in v1.2.0

func PathUsed() string

PathUsed returns the used config path

func SetConfig

func SetConfig(c *Config)

SetConfig sets the config to c

func Setup added in v1.1.0

func Setup(configPath string) error

Setup reads the config file and parses it

func SetupWithName added in v1.1.0

func SetupWithName(configPath string, configName string) error

SetupWithName reads the config file and parses it and allows to set the name

Types

type Config

type Config struct {
	Listen ListenConfig
	Forms  []*FormConfig
}

Config is the type which contains all above sub-configs

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default config

func GetConfig

func GetConfig() *Config

GetConfig returns the config

type FormConfig

type FormConfig struct {
	Enabled   bool
	ID        string
	Turnstile TurnstileConfig
	Targets   []*TargetConfig
}

FormConfig is the config of a form

type ListenConfig

type ListenConfig struct {
	Host                string
	Port                int
	UseForwardedHeaders bool
}

ListenConfig is for the server

type OnConfigChangeFunc added in v1.1.0

type OnConfigChangeFunc func(event fsnotify.Event, config *Config, oldConfig *Config)

OnConfigChangeFunc is the type of a function which can be used as a callback

type TargetConfig

type TargetConfig struct {
	Enabled     bool
	Template    string
	ShoutrrrURL string
	Params      map[string]interface{}
}

TargetConfig is the config of a shoutrrr target

type TurnstileConfig added in v1.3.0

type TurnstileConfig struct {
	Enabled   bool
	SecretKey string
}

TurnstileConfig is the config for HCapthca

Jump to

Keyboard shortcuts

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