models

package
v0.0.0-...-1746241 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 14 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AIServiceNone   string = "none"
	AIServiceOpenAI string = "openai"
	AIServiceClaude string = "claude"
)
View Source
const (
	EmailPlaceholderAppName   string = "{APP_NAME}"
	EmailPlaceholderAppUrl    string = "{APP_URL}"
	EmailPlaceholderToken     string = "{TOKEN}"
	EmailPlaceholderActionUrl string = "{ACTION_URL}"
)

Common settings placeholder tokens

View Source
const (
	ParamAppSettings = "settings"
)
View Source
const SecretMask string = "******"

SecretMask is the default settings secrets replacement value (see Settings.RedactClone()).

Variables

This section is empty.

Functions

This section is empty.

Types

type AIConfig

type AIConfig struct {
	Service      string `form:"service" json:"service"`
	Model        string `form:"model" json:"model"`
	APIKey       string `form:"apiKey" json:"apiKey"`
	AnthropicKey string `form:"anthropicKey" json:"anthropicKey"`
}

func (AIConfig) Validate

func (c AIConfig) Validate() error

Validate makes AIConfig validatable by implementing validation.Validatable interface.

type AuthProviderConfig

type AuthProviderConfig struct {
	Enabled      bool   `form:"enabled" json:"enabled"`
	ClientId     string `form:"clientId" json:"clientId"`
	ClientSecret string `form:"clientSecret" json:"clientSecret"`
	AuthUrl      string `form:"authUrl" json:"authUrl"`
	TokenUrl     string `form:"tokenUrl" json:"tokenUrl"`
	UserApiUrl   string `form:"userApiUrl" json:"userApiUrl"`
	DisplayName  string `form:"displayName" json:"displayName"`
	PKCE         *bool  `form:"pkce" json:"pkce"`
}

func (AuthProviderConfig) SetupProvider

func (c AuthProviderConfig) SetupProvider(provider auth.Provider) error

SetupProvider loads the current AuthProviderConfig into the specified provider.

func (AuthProviderConfig) Validate

func (c AuthProviderConfig) Validate() error

Validate makes `ProviderConfig` validatable by implementing validation.Validatable interface.

type BackupsConfig

type BackupsConfig struct {
	// Cron is a cron expression to schedule auto backups, eg. "* * * * *".
	//
	// Leave it empty to disable the auto backups functionality.
	Cron string `form:"cron" json:"cron"`

	// CronMaxKeep is the max number of cron generated backups to
	// keep before removing older entries.
	//
	// This field works only when the cron config has valid cron expression.
	CronMaxKeep int `form:"cronMaxKeep" json:"cronMaxKeep"`

	// S3 is an optional S3 storage config specifying where to store the app backups.
	S3 S3Config `form:"s3" json:"s3"`
}

func (BackupsConfig) Validate

func (c BackupsConfig) Validate() error

Validate makes BackupsConfig validatable by implementing validation.Validatable interface.

type BaseModel

type BaseModel = basemodels.BaseModel

type CalendarConfig

type CalendarConfig struct {
	ClientID     string `form:"clientId" json:"clientId"`
	ClientSecret string `form:"clientSecret" json:"clientSecret"`
	RedirectURL  string `form:"redirectUrl" json:"redirectUrl"`
}

func (CalendarConfig) Validate

func (c CalendarConfig) Validate() error

Validate makes CalendarConfig validatable by implementing validation.Validatable interface.

type EmailAuthConfig

type EmailAuthConfig struct {
	Enabled           bool     `form:"enabled" json:"enabled"`
	ExceptDomains     []string `form:"exceptDomains" json:"exceptDomains"`
	OnlyDomains       []string `form:"onlyDomains" json:"onlyDomains"`
	MinPasswordLength int      `form:"minPasswordLength" json:"minPasswordLength"`
}

func (EmailAuthConfig) Validate

func (c EmailAuthConfig) Validate() error

type EmailTemplate

type EmailTemplate struct {
	Body      string `form:"body" json:"body"`
	Subject   string `form:"subject" json:"subject"`
	ActionUrl string `form:"actionUrl" json:"actionUrl"`
	Hidden    bool   `form:"hidden" json:"hidden"`
}

func (EmailTemplate) Resolve

func (t EmailTemplate) Resolve(
	appName string,
	appUrl,
	token string,
) (subject, body, actionUrl string)

Resolve replaces the placeholder parameters in the current email template and returns its components as ready-to-use strings.

func (EmailTemplate) Validate

func (t EmailTemplate) Validate() error

Validate makes EmailTemplate validatable by implementing validation.Validatable interface.

type LogsConfig

type LogsConfig struct {
	MaxDays  int  `form:"maxDays" json:"maxDays"`
	MinLevel int  `form:"minLevel" json:"minLevel"`
	LogIp    bool `form:"logIp" json:"logIp"`
}

func (LogsConfig) Validate

func (c LogsConfig) Validate() error

Validate makes LogsConfig validatable by implementing validation.Validatable interface.

type MailConfig

type MailConfig struct {
	ClientID     string `form:"clientId" json:"clientId"`
	ClientSecret string `form:"clientSecret" json:"clientSecret"`
	RedirectURL  string `form:"redirectUrl" json:"redirectUrl"`
}

func (MailConfig) Validate

func (c MailConfig) Validate() error

Validate makes MailConfig validatable by implementing validation.Validatable interface.

type MetaConfig

type MetaConfig struct {
	AppName                    string        `form:"appName" json:"appName"`
	AppUrl                     string        `form:"appUrl" json:"appUrl"`
	HideControls               bool          `form:"hideControls" json:"hideControls"`
	SenderName                 string        `form:"senderName" json:"senderName"`
	SenderAddress              string        `form:"senderAddress" json:"senderAddress"`
	VerificationTemplate       EmailTemplate `form:"verificationTemplate" json:"verificationTemplate"`
	ResetPasswordTemplate      EmailTemplate `form:"resetPasswordTemplate" json:"resetPasswordTemplate"`
	ConfirmEmailChangeTemplate EmailTemplate `form:"confirmEmailChangeTemplate" json:"confirmEmailChangeTemplate"`
}

func (MetaConfig) Validate

func (c MetaConfig) Validate() error

Validate makes MetaConfig validatable by implementing validation.Validatable interface.

type Model

type Model = basemodels.Model

type Param

type Param struct {
	BaseModel

	Key   string        `db:"key" json:"key"`
	Value types.JsonRaw `db:"value" json:"value"`
}

func (*Param) TableName

func (m *Param) TableName() string

type S3Config

type S3Config struct {
	Enabled        bool   `form:"enabled" json:"enabled"`
	Bucket         string `form:"bucket" json:"bucket"`
	Region         string `form:"region" json:"region"`
	Endpoint       string `form:"endpoint" json:"endpoint"`
	AccessKey      string `form:"accessKey" json:"accessKey"`
	Secret         string `form:"secret" json:"secret"`
	ForcePathStyle bool   `form:"forcePathStyle" json:"forcePathStyle"`
}

func (S3Config) Validate

func (c S3Config) Validate() error

Validate makes S3Config validatable by implementing validation.Validatable interface.

type Settings

type Settings struct {
	Meta     MetaConfig     `form:"meta" json:"meta"`
	Logs     LogsConfig     `form:"logs" json:"logs"`
	Smtp     SmtpConfig     `form:"smtp" json:"smtp"`
	S3       S3Config       `form:"s3" json:"s3"`
	Backups  BackupsConfig  `form:"backups" json:"backups"`
	AI       AIConfig       `form:"ai" json:"ai"`
	Calendar CalendarConfig `form:"calendar" json:"calendar"`
	Mail     MailConfig     `form:"mail" json:"mail"`
	Weather  WeatherConfig  `form:"weather" json:"weather"`

	RecordAuthToken          TokenConfig `form:"recordAuthToken" json:"recordAuthToken"`
	RecordPasswordResetToken TokenConfig `form:"recordPasswordResetToken" json:"recordPasswordResetToken"`
	RecordEmailChangeToken   TokenConfig `form:"recordEmailChangeToken" json:"recordEmailChangeToken"`
	RecordVerificationToken  TokenConfig `form:"recordVerificationToken" json:"recordVerificationToken"`
	RecordFileToken          TokenConfig `form:"recordFileToken" json:"recordFileToken"`

	EmailAuth EmailAuthConfig `form:"emailAuth" json:"emailAuth"`

	GithubAuth AuthProviderConfig `form:"githubAuth" json:"githubAuth"`

	VKAuth     AuthProviderConfig `form:"vkAuth" json:"vkAuth"`
	YandexAuth AuthProviderConfig `form:"yandexAuth" json:"yandexAuth"`
	// contains filtered or unexported fields
}

Settings defines common app configuration options.

func NewSettings

func NewSettings() *Settings

New creates and returns a new default Settings instance.

func (*Settings) Clone

func (s *Settings) Clone() (*Settings, error)

Clone creates a new deep copy of the current settings.

func (*Settings) Merge

func (s *Settings) Merge(other *Settings) error

Merge merges `other` settings into the current one.

func (*Settings) NamedAuthProviderConfigs

func (s *Settings) NamedAuthProviderConfigs() map[string]AuthProviderConfig

NamedAuthProviderConfigs returns a map with all registered OAuth2 provider configurations (indexed by their name identifier).

func (*Settings) RedactClone

func (s *Settings) RedactClone() (*Settings, error)

RedactClone creates a new deep copy of the current settings, while replacing the secret values with `******`.

func (*Settings) Validate

func (s *Settings) Validate() error

Validate makes Settings validatable by implementing validation.Validatable interface.

type SmtpConfig

type SmtpConfig struct {
	Enabled  bool   `form:"enabled" json:"enabled"`
	Host     string `form:"host" json:"host"`
	Port     int    `form:"port" json:"port"`
	Username string `form:"username" json:"username"`
	Password string `form:"password" json:"password"`

	// SMTP AUTH - PLAIN (default) or LOGIN
	AuthMethod string `form:"authMethod" json:"authMethod"`

	// Whether to enforce TLS encryption for the mail server connection.
	//
	// When set to false StartTLS command is send, leaving the server
	// to decide whether to upgrade the connection or not.
	Tls bool `form:"tls" json:"tls"`

	// LocalName is optional domain name or IP address used for the
	// EHLO/HELO exchange (if not explicitly set, defaults to "localhost").
	//
	// This is required only by some SMTP servers, such as Gmail SMTP-relay.
	LocalName string `form:"localName" json:"localName"`
}

func (SmtpConfig) Validate

func (c SmtpConfig) Validate() error

Validate makes SmtpConfig validatable by implementing validation.Validatable interface.

type TokenConfig

type TokenConfig struct {
	Secret   string `form:"secret" json:"secret"`
	Duration int64  `form:"duration" json:"duration"`
}

func (TokenConfig) Validate

func (c TokenConfig) Validate() error

Validate makes TokenConfig validatable by implementing validation.Validatable interface.

type WeatherConfig

type WeatherConfig struct {
	APIKey string `form:"apiKey" json:"apiKey"`
	Units  string `form:"units" json:"units"`
	Lang   string `form:"lang" json:"lang"`
}

func (WeatherConfig) Validate

func (c WeatherConfig) Validate() error

Validate makes WeatherConfig validatable by implementing validation.Validatable interface.

Jump to

Keyboard shortcuts

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