config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 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 Database

type Database struct {
	User     string `mapstructure:"user" yaml:"user" json:"user"`
	Password string `mapstructure:"password" yaml:"password" json:"password"`
	Host     string `mapstructure:"host" yaml:"host" json:"host"`
	Name     string `mapstructure:"name" yaml:"name" json:"name"`
	Port     int    `mapstructure:"port" yaml:"port" json:"port"`
	SSLMode  bool   `mapstructure:"ssl_mode" yaml:"ssl_mode" json:"ssl_mode"`
}

func (Database) Connect added in v0.4.0

func (db Database) Connect() (*sql.DB, error)

func (Database) ConnectAndPing added in v0.4.0

func (db Database) ConnectAndPing(log *slog.Logger) (*sql.DB, error)

type Keys

type Keys struct {
	PrivateKeyLocation string `json:"private_key" mapstructure:"private_key"`
	PublicKeyLocation  string `json:"public_key" mapstructure:"public_key"`
	PrivateKey         *rsa.PrivateKey
	PublicKey          *rsa.PublicKey
}

func (*Keys) MustParse

func (k *Keys) MustParse()

func (*Keys) Parse

func (k *Keys) Parse() error

type Server

type Server struct {
	Mode         string
	Hostname     string
	Url          string
	Port         string
	ProblemsDir  string
	TemplatesDir string

	CookieSecret string

	GoogleAuth struct {
		Enabled   bool   `json:"enabled" mapstructure:"enabled"`
		ClientKey string `json:"client_key" mapstructure:"client_key"`
		Secret    string `json:"secret" mapstructure:"secret"`
		Callback  string `json:"callback" mapstructure:"callback"`
	} `json:"googleAuth" mapstructure:"googleAuth"`

	Sendgrid struct {
		Enabled       bool   `json:"enabled" mapstructure:"enabled"`
		ApiKey        string `json:"api_key" mapstructure:"api_key"`
		SenderName    string `json:"sender_name" mapstructure:"sender_name"`
		SenderAddress string `json:"sender_address" mapstructure:"sender_address"`
	} `json:"sendgrid" mapstructure:"sendgrid"`

	SMTP struct {
		Enabled             bool   `json:"enabled" mapstructure:"enabled"`
		MailAccount         string `json:"mail_account" mapstructure:"mail_account"`
		MailServerHost      string `json:"mail_server" mapstructure:"mail_server"`
		MailServerPort      string `json:"mail_port" mapstructure:"mail_port"`
		MailAccountPassword string `json:"mail_password" mapstructure:"mail_password"`
	} `json:"smtp" mapstructure:"smtp"`

	Database `json:"database" mapstructure:"database"`

	Keys Keys
}

Jump to

Keyboard shortcuts

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