config

package
v0.0.0-...-9d4acdc Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: AGPL-3.0 Imports: 9 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 {
	Server   Server
	Webauthn WebauthnSettings
	Passcode Passcode
	Password Password
	Database Database
	Secrets  Secrets
	Service  Service
	Session  Session
}

Config is the central configuration type

func Load

func Load(cfgFile *string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error
type Cookie struct {
	Domain   string
	HttpOnly bool   `koanf:"http_only"`
	SameSite string `koanf:"same_site"`
}

type Cors

type Cors struct {
	Enabled          bool
	AllowCredentials bool     `koanf:"allow_credentials"`
	AllowOrigins     []string `koanf:"allow_origins"`
	AllowMethods     []string `koanf:"allow_methods"`
	AllowHeaders     []string `koanf:"allow_headers"`
	ExposeHeaders    []string `koanf:"expose_headers"`
	MaxAge           int      `koanf:"max_age"`
}

type Database

type Database struct {
	Database string `json:"database"`
	User     string `json:"user"`
	Password string `json:"password"`
	Host     string `json:"host"`
	Port     string `json:"port"`
	Dialect  string `json:"dialect"`
}

Database connection settings

func (*Database) Validate

func (d *Database) Validate() error

type Email

type Email struct {
	FromAddress string `koanf:"from_address"`
	FromName    string `koanf:"from_name"`
}

func (*Email) Validate

func (e *Email) Validate() error

type Passcode

type Passcode struct {
	Email Email
	Smtp  SMTP
	TTL   int
}

func (*Passcode) Validate

func (p *Passcode) Validate() error

type Password

type Password struct {
	Enabled bool `json:"enabled"`
}

type RelyingParty

type RelyingParty struct {
	Id          string
	DisplayName string `koanf:"display_name"`
	Icon        string
	Origin      string
}

RelyingParty webauthn settings for your application using hanko.

type SMTP

type SMTP struct {
	Host     string
	Port     string
	User     string
	Password string
}

SMTP Server Settings for sending passcodes

func (*SMTP) Validate

func (s *SMTP) Validate() error

type Secrets

type Secrets struct {
	// Keys secret is used to en- and decrypt the JWKs which get used to sign the JWT tokens.
	// For every key a JWK is generated, encrypted with the key and persisted in the database.
	// The first key in the list is the one getting used for signing. If you want to use a new key, add it to the top of the list.
	// You can use this list for key rotation.
	// Each key must be at least 16 characters long.
	Keys []string `json:"keys"`
}

func (*Secrets) Validate

func (s *Secrets) Validate() error

type Server

type Server struct {
	Public  ServerSettings
	Private ServerSettings
}

Server contains the setting for the public and private server

func (*Server) Validate

func (s *Server) Validate() error

type ServerSettings

type ServerSettings struct {
	// The Address to listen on in the form of host:port
	// See net.Dial for details of the address format.
	Address string
	Cors    Cors
}

func (*ServerSettings) Validate

func (s *ServerSettings) Validate() error

type Service

type Service struct {
	Name string
}

func (*Service) Validate

func (s *Service) Validate() error

type Session

type Session struct {
	Lifespan string
	Cookie   Cookie
}

func (*Session) Validate

func (s *Session) Validate() error

type WebauthnSettings

type WebauthnSettings struct {
	RelyingParty RelyingParty `koanf:"relying_party"`
	Timeout      int
}

WebauthnSettings defines the settings for the webauthn authentication mechanism

func (*WebauthnSettings) Validate

func (r *WebauthnSettings) Validate() error

Validate does not need to validate the config, because the library does this already

Jump to

Keyboard shortcuts

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