Documentation ¶
Index ¶
Constants ¶
const ( EmailPlaceholderAppName string = "{APP_NAME}" EmailPlaceholderAppUrl string = "{APP_URL}" EmailPlaceholderToken string = "{TOKEN}" EmailPlaceholderActionUrl string = "{ACTION_URL}" )
Common settings placeholder tokens
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 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"` }
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 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 EmailAuthConfig
deprecated
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"` }
Deprecated: Will be removed in v0.9+
func (EmailAuthConfig) Validate
deprecated
func (c EmailAuthConfig) Validate() error
Deprecated: Will be removed in v0.9+
type EmailTemplate ¶
type EmailTemplate struct { Body string `form:"body" json:"body"` Subject string `form:"subject" json:"subject"` ActionUrl string `form:"actionUrl" json:"actionUrl"` }
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"`
}
func (LogsConfig) Validate ¶
func (c LogsConfig) Validate() error
Validate makes LogsConfig 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 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 ¶
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"` AdminAuthToken TokenConfig `form:"adminAuthToken" json:"adminAuthToken"` AdminPasswordResetToken TokenConfig `form:"adminPasswordResetToken" json:"adminPasswordResetToken"` AdminFileToken TokenConfig `form:"adminFileToken" json:"adminFileToken"` 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"` // Deprecated: Will be removed in v0.9+ EmailAuth EmailAuthConfig `form:"emailAuth" json:"emailAuth"` GoogleAuth AuthProviderConfig `form:"googleAuth" json:"googleAuth"` FacebookAuth AuthProviderConfig `form:"facebookAuth" json:"facebookAuth"` GithubAuth AuthProviderConfig `form:"githubAuth" json:"githubAuth"` GitlabAuth AuthProviderConfig `form:"gitlabAuth" json:"gitlabAuth"` DiscordAuth AuthProviderConfig `form:"discordAuth" json:"discordAuth"` TwitterAuth AuthProviderConfig `form:"twitterAuth" json:"twitterAuth"` MicrosoftAuth AuthProviderConfig `form:"microsoftAuth" json:"microsoftAuth"` SpotifyAuth AuthProviderConfig `form:"spotifyAuth" json:"spotifyAuth"` KakaoAuth AuthProviderConfig `form:"kakaoAuth" json:"kakaoAuth"` TwitchAuth AuthProviderConfig `form:"twitchAuth" json:"twitchAuth"` StravaAuth AuthProviderConfig `form:"stravaAuth" json:"stravaAuth"` GiteeAuth AuthProviderConfig `form:"giteeAuth" json:"giteeAuth"` LivechatAuth AuthProviderConfig `form:"livechatAuth" json:"livechatAuth"` GiteaAuth AuthProviderConfig `form:"giteaAuth" json:"giteaAuth"` OIDCAuth AuthProviderConfig `form:"oidcAuth" json:"oidcAuth"` OIDC2Auth AuthProviderConfig `form:"oidc2Auth" json:"oidc2Auth"` OIDC3Auth AuthProviderConfig `form:"oidc3Auth" json:"oidc3Auth"` AppleAuth AuthProviderConfig `form:"appleAuth" json:"appleAuth"` InstagramAuth AuthProviderConfig `form:"instagramAuth" json:"instagramAuth"` VKAuth AuthProviderConfig `form:"vkAuth" json:"vkAuth"` YandexAuth AuthProviderConfig `form:"yandexAuth" json:"yandexAuth"` // contains filtered or unexported fields }
Settings defines common app configuration options.
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 ¶
RedactClone creates a new deep copy of the current settings, while replacing the secret values with `******`.
func (*Settings) Validate ¶
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"` }
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.