config

package
v0.0.0-...-94e6d93 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Database string `default:"postgres://localhost/nebula" usage:"PostgreSQL DSN to connect to (i.e. postgres://localhost/nebula)"`
	Log      struct {
		Level string `default:"info"`
		File  string
		JSON  bool `default:"false" usage:"Output JSONND instead of pretty console messages"`
	}
	HTTP struct {
		Address    string `default:"127.0.0.1:8080" usage:"Adress to listen on"`
		BaseURL    string `default:"http://example.com" usage:"Public URL for this server"`
		StaticRoot string `default:"./front" usage:"Path to the directory containing the compiled front package"`
		SyncRoot   string `default:"./sync" usage:"Path to the directory containing the modsync files"`
	}
	Argon2 struct {
		Memory      uint32 `default:"65536"`
		Iterations  uint32 `default:"3"`
		Parallelism uint8  `default:"2"`
		SaltLength  uint32 `default:"16"`
		KeyLength   uint32 `default:"32"`
	}
	Keys struct {
		VersionUpdateKey string `usage:"The token used by the CI to update release versions"`
	}
	Mail struct {
		From       string `usage:"Mail sender"`
		Server     string `usage:"SMTP server"`
		Port       int
		Encryption string `default:"STARTTLS" usage:"Transport encryption (STARTTLS, SSL or None)"`
		Username   string
		Password   string

		Register struct {
			Subject string `default:"[FSNebula] Welcome!" usage:"Registration mail subject"`
			Text    string `usage:"Text template for the registration mail"`
			HTML    string `usage:"HTML template for the registration mail"`
		}

		Reset struct {
			Subject string `default:"[FSNebula] Password reset" usage:"Password reset subject"`
			Text    string `usage:"Text template for the password reset mail"`
			HTML    string `usage:"HTML template for the password reset mail"`
		}
	}
}

Config describes all configuration options

func Loader

func Loader() (*Config, *aconfig.Loader)

Loader initializes an empty config object and returns a new Loader for this object

func (*Config) LogLevel

func (cfg *Config) LogLevel() zerolog.Level

LogLevel converts the .Log.Level field to a zerolog.Level

func (*Config) Validate

func (cfg *Config) Validate() error

Validate verifies that all config fields have valid values

Jump to

Keyboard shortcuts

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