config

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: CC-BY-4.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvLogLevel                         = "GOTIFY_LOGLEVEL"
	EnvServerKeepAlivePeriodSeconds     = "GOTIFY_SERVER_KEEPALIVEPERIODSECONDS"
	EnvServerListenAddr                 = "GOTIFY_SERVER_LISTENADDR"
	EnvServerPort                       = "GOTIFY_SERVER_PORT"
	EnvServerSSLEnabled                 = "GOTIFY_SERVER_SSL_ENABLED"
	EnvServerSSLRedirectToHTTPS         = "GOTIFY_SERVER_SSL_REDIRECTTOHTTPS"
	EnvServerSSLListenAddr              = "GOTIFY_SERVER_SSL_LISTENADDR"
	EnvServerSSLPort                    = "GOTIFY_SERVER_SSL_PORT"
	EnvServerSSLCertFile                = "GOTIFY_SERVER_SSL_CERTFILE"
	EnvServerSSLCertKey                 = "GOTIFY_SERVER_SSL_CERTKEY"
	EnvServerSSLLetsEncryptEnabled      = "GOTIFY_SERVER_SSL_LETSENCRYPT_ENABLED"
	EnvServerSSLLetsEncryptAcceptTOS    = "GOTIFY_SERVER_SSL_LETSENCRYPT_ACCEPTTOS"
	EnvServerSSLLetsEncryptCache        = "GOTIFY_SERVER_SSL_LETSENCRYPT_CACHE"
	EnvServerSSLLetsEncryptDirectoryURL = "GOTIFY_SERVER_SSL_LETSENCRYPT_DIRECTORYURL"
	EnvServerSSLLetsEncryptHosts        = "GOTIFY_SERVER_SSL_LETSENCRYPT_HOSTS"
	EnvServerResponseHeaders            = "GOTIFY_SERVER_RESPONSEHEADERS"
	EnvServerStreamPingPeriodSeconds    = "GOTIFY_SERVER_STREAM_PINGPERIODSECONDS"
	EnvServerStreamAllowedOrigins       = "GOTIFY_SERVER_STREAM_ALLOWEDORIGINS"
	EnvServerCorsAllowOrigins           = "GOTIFY_SERVER_CORS_ALLOWORIGINS"
	EnvServerCorsAllowMethods           = "GOTIFY_SERVER_CORS_ALLOWMETHODS"
	EnvServerCorsAllowHeaders           = "GOTIFY_SERVER_CORS_ALLOWHEADERS"
	EnvServerTrustedProxies             = "GOTIFY_SERVER_TRUSTEDPROXIES"
	EnvServerSecureCookie               = "GOTIFY_SERVER_SECURECOOKIE"
	EnvDatabaseDialect                  = "GOTIFY_DATABASE_DIALECT"
	EnvDatabaseConnection               = "GOTIFY_DATABASE_CONNECTION"
	EnvDefaultUserName                  = "GOTIFY_DEFAULTUSER_NAME"
	EnvDefaultUserPass                  = "GOTIFY_DEFAULTUSER_PASS"
	EnvPassStrength                     = "GOTIFY_PASSSTRENGTH"
	EnvUploadedImagesDir                = "GOTIFY_UPLOADEDIMAGESDIR"
	EnvPluginsDir                       = "GOTIFY_PLUGINSDIR"
	EnvRegistration                     = "GOTIFY_REGISTRATION"
	EnvLocalAuthEnabled                 = "GOTIFY_LOCALAUTH_ENABLED"
	EnvOIDCEnabled                      = "GOTIFY_OIDC_ENABLED"
	EnvOIDCIssuer                       = "GOTIFY_OIDC_ISSUER"
	EnvOIDCClientID                     = "GOTIFY_OIDC_CLIENTID"
	EnvOIDCClientSecret                 = "GOTIFY_OIDC_CLIENTSECRET"
	EnvOIDCUsernameClaim                = "GOTIFY_OIDC_USERNAMECLAIM"
	EnvOIDCGroupsClaim                  = "GOTIFY_OIDC_GROUPS_CLAIM"
	EnvOIDCGroupsUser                   = "GOTIFY_OIDC_GROUPS_USER"
	EnvOIDCGroupsAdmin                  = "GOTIFY_OIDC_GROUPS_ADMIN"
	EnvOIDCRedirectURL                  = "GOTIFY_OIDC_REDIRECTURL"
	EnvOIDCAutoRegister                 = "GOTIFY_OIDC_AUTOREGISTER"
	EnvOIDCLinkByUsername               = "GOTIFY_OIDC_LINK_BY_USERNAME"
	EnvOIDCScopes                       = "GOTIFY_OIDC_SCOPES"
	EnvOIDCIDPName                      = "GOTIFY_OIDC_IDP_NAME"
	EnvOIDCAutoRedirect                 = "GOTIFY_OIDC_AUTO_REDIRECT"
	EnvOIDCPrompt                       = "GOTIFY_OIDC_PROMPT"
	EnvNoColor                          = "NOCOLOR"
)

Variables

This section is empty.

Functions

func Get

func Get() (*Configuration, []FutureLog)

Get returns the configuration extracted from env variables.

Types

type Configuration

type Configuration struct {
	LogLevel          LogLevel
	Server            Server
	Database          Database
	DefaultUser       DefaultUser
	PassStrength      int
	UploadedImagesDir string
	PluginsDir        string
	Registration      bool
	LocalAuthEnabled  bool
	OIDC              OIDC
	NoColor           string
}

type Cors

type Cors struct {
	AllowOrigins []string
	AllowMethods []string
	AllowHeaders []string
}

type Database

type Database struct {
	Dialect    string
	Connection string
}

type DefaultUser

type DefaultUser struct {
	Name string
	Pass string
}

type FutureLog

type FutureLog struct {
	Level zerolog.Level
	Msg   string
}

FutureLog is an intermediate type for log messages. It is used before the config was loaded because without loaded config we do not know the log level, so we log these messages once the config was initialized.

type LetsEncrypt

type LetsEncrypt struct {
	Enabled      bool
	AcceptTOS    bool
	Cache        string
	DirectoryURL string
	Hosts        []string
}

type LogLevel

type LogLevel zerolog.Level

LogLevel type that provides helper methods for decoding.

func (LogLevel) AsZeroLogLevel

func (ll LogLevel) AsZeroLogLevel() zerolog.Level

AsZeroLogLevel converts the LogLevel to a zerolog.Level.

func (*LogLevel) Decode

func (ll *LogLevel) Decode(value string) error

Decode decodes a string to a log level.

type OIDC

type OIDC struct {
	Enabled        bool
	Issuer         string
	ClientID       string
	ClientSecret   string
	UsernameClaim  string
	GroupsClaim    string
	GroupsUser     []string
	GroupsAdmin    []string
	RedirectURL    string
	AutoRegister   bool
	LinkByUsername bool
	Scopes         []string
	IDPName        string
	AutoRedirect   bool
	Prompt         []string
}

type SSL

type SSL struct {
	Enabled         bool
	RedirectToHTTPS bool
	ListenAddr      string
	Port            int
	CertFile        string
	CertKey         string
	LetsEncrypt     LetsEncrypt
}

type Server

type Server struct {
	KeepAlivePeriodSeconds int
	ListenAddr             string
	Port                   int
	SSL                    SSL
	ResponseHeaders        map[string]string
	Stream                 Stream
	Cors                   Cors
	TrustedProxies         []string
	SecureCookie           bool
}

type Stream

type Stream struct {
	PingPeriodSeconds int
	AllowedOrigins    []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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