config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BehaviourConfiguration

type BehaviourConfiguration struct {
	Name                string
	Site                string
	InviteOnly          bool          `mapstructure:"invite-only"`
	InviteRole          *string       `mapstructure:"invite-role"`
	InviteExpiry        time.Duration `mapstructure:"invite-expiry"`
	AutoConfirmUsers    bool          `mapstructure:"auto-confirm-users"`
	DefaultLocale       string        `mapstructure:"default-locale"`
	AutoLockoutCount    int           `mapstructure:"auto-lockout-count"`
	AutoLockoutDuration time.Duration `mapstructure:"auto-lockout-duration"`
	PasswordMinLength   int           `mapstructure:"password-min-length"`
	ServiceDomain       string        `mapstructure:"service-domain"`
}

BehaviourConfiguration configures hwo the service will behave

type CORSConfiguration

type CORSConfiguration struct {
	AllowCredentials bool     `mapstructure:"allow-credentials"`
	AllowedMethods   []string `mapstructure:"allowed-methods"`
	AllowedOrigins   []string `mapstructure:"allowed-origins"`
}

CORSConfiguration very basic cors configuration

type Configuration

type Configuration struct {
	Server         *ServerConfiguration         `mapstructure:"server"`
	SMTP           *SMTPConfiguration           `mapstructure:"smtp"`
	Database       *DatabaseConfiguration       `mapstructure:"database"`
	Behaviour      *BehaviourConfiguration      `mapstructure:"behaviour"`
	JWT            *JWTConfiguration            `mapstructure:"jwt"`
	ManageEndpoint *ManageEndpointConfirugation `mapstructure:"manage-endpoint"`
}

Configuration habours the entire gotrxx configuration

func (*Configuration) DebugMode

func (*Configuration) DebugMode() bool

DebugMode returns true if the DEBUG_MODE variable is set

func (*Configuration) Validate

func (c *Configuration) Validate() error

Validate does some basic validation of the config file and tries to be helpful on missconfiguration

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Type string
	DSN  string `json:"-"`
}

DatabaseConfiguration contains the settings required to connect to a database

type FileSystems

type FileSystems struct {
	StaticFolder fs.FS
	Templates    fs.FS
}

FileSystems contains the used file systems

type JWTConfiguration

type JWTConfiguration struct {
	FlattenAudience    bool          `mapstructure:"flatten-audience"`
	Algorithm          string        `mapstructure:"alg"`
	Issuer             string        `mapstructure:"iss"`
	Audience           []string      `mapstructure:"aud"`
	Expiry             time.Duration `mapstructure:"exp"`
	NoRolesClaim       bool          `mapstructure:"no-roles-claim"`
	HMACSigningKey     string        `mapstructure:"hmac-signing-key"      json:"-"`
	HMACSigningKeyFile string        `mapstructure:"hmac-signing-key-file"`

	RSAPrivateKey string `mapstructure:"rsa-private-key" json:"-"`
	RSAPublicKey  string `mapstructure:"rsa-public-key"  json:"-"`

	RSAPRivateKeyFile string `mapstructure:"rsa-private-key-file"`
	RSAPublicKeyFile  string `mapstructure:"rsa-public-key-file"`

	RefreshTokenExpiry time.Duration `mapstructure:"refresh-token-expiry"`
	RememberMeDuration time.Duration `mapstructure:"remember-me-duration"`
}

JWTConfiguration habours all JWT and refresh token settings

type ManageEndpointConfirugation

type ManageEndpointConfirugation struct {
	Enable bool
	CORS   *CORSConfiguration
}

ManageEndpointConfirugation habours the manage endpoitn configuration

type SMTPConfiguration

type SMTPConfiguration struct {
	Enabled  bool
	Host     string
	Port     int
	Username string
	Password string `json:"-"`
	//DisplayName will be displayed as email sender
	DisplayName string `         mapstructure:"display-name"`
	//Address is the sender address
	Address string
}

SMTPConfiguration contains the email settings

type ServerConfiguration

type ServerConfiguration struct {
	Port               int
	Address            string
	CSRFToken          string `mapstructure:"csrf-token"     json:"-"`
	LoadTemplateFolder bool   `mapstructure:"load-templates"`
}

ServerConfiguration contains the server settings

Jump to

Keyboard shortcuts

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