Add instance settings and mail delivery through PocketBase
Superadmins can now change signup rules (on/off and the domain allow-list) and branding at runtime; the environment variables only seed the defaults. Mail and S3 storage settings pass through to PocketBase's own settings, and docwell-server sends its own emails through a PocketBase hook so there is a single SMTP configuration. The boot hook no longer wipes SMTP settings that were not set from the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ba394b8fac
commit
e33a99241e
21 files changed
+1714
-25
No files matched your search
@@ -184,6 +184,15 @@ type AuthMethods struct {
|
||||
Signup bool `json:"signup"`
|
||||
}
|
||||
|
||||
// BrandingSettings defines model for BrandingSettings.
|
||||
type BrandingSettings struct {
|
||||
AccentColor string `json:"accentColor"`
|
||||
AppName string `json:"appName"`
|
||||
|
||||
// Logo data:image/(png|jpeg|webp|svg+xml);base64,..., at most 256 KB
|
||||
Logo string `json:"logo"`
|
||||
}
|
||||
|
||||
// CreateUserRequest defines model for CreateUserRequest.
|
||||
type CreateUserRequest struct {
|
||||
Email openapi_types.Email `json:"email"`
|
||||
@@ -213,6 +222,22 @@ type Error struct {
|
||||
MfaId *string `json:"mfaId,omitempty"`
|
||||
}
|
||||
|
||||
// InstanceSettings defines model for InstanceSettings.
|
||||
type InstanceSettings struct {
|
||||
Branding BrandingSettings `json:"branding"`
|
||||
Signup SignupSettings `json:"signup"`
|
||||
Smtp SmtpSettings `json:"smtp"`
|
||||
Storage StorageSettings `json:"storage"`
|
||||
}
|
||||
|
||||
// InstanceSettingsUpdate defines model for InstanceSettingsUpdate.
|
||||
type InstanceSettingsUpdate struct {
|
||||
Branding *BrandingSettings `json:"branding,omitempty"`
|
||||
Signup *SignupSettings `json:"signup,omitempty"`
|
||||
Smtp *SmtpSettings `json:"smtp,omitempty"`
|
||||
Storage *StorageSettings `json:"storage,omitempty"`
|
||||
}
|
||||
|
||||
// LoginRequest defines model for LoginRequest.
|
||||
type LoginRequest struct {
|
||||
Email openapi_types.Email `json:"email"`
|
||||
@@ -292,6 +317,19 @@ type PageVersion struct {
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
// PublicSettings defines model for PublicSettings.
|
||||
type PublicSettings struct {
|
||||
// AccentColor #rrggbb, or empty for the default
|
||||
AccentColor string `json:"accentColor"`
|
||||
AppName string `json:"appName"`
|
||||
|
||||
// Logo A data URL
|
||||
Logo string `json:"logo"`
|
||||
|
||||
// Signup Self-service signup is open
|
||||
Signup bool `json:"signup"`
|
||||
}
|
||||
|
||||
// Role Instance role. admin manages their own organization; superadmin manages everything.
|
||||
type Role string
|
||||
|
||||
@@ -308,6 +346,28 @@ type SignupRequest struct {
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// SignupSettings defines model for SignupSettings.
|
||||
type SignupSettings struct {
|
||||
// Domains Allowed email domains; empty allows all
|
||||
Domains []string `json:"domains"`
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SmtpSettings defines model for SmtpSettings.
|
||||
type SmtpSettings struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Host string `json:"host"`
|
||||
|
||||
// Password Leave out to keep the stored password
|
||||
Password *string `json:"password,omitempty"`
|
||||
PasswordSet *bool `json:"passwordSet,omitempty"`
|
||||
Port int `json:"port"`
|
||||
SenderAddress string `json:"senderAddress"`
|
||||
SenderName string `json:"senderName"`
|
||||
Tls bool `json:"tls"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
// Space defines model for Space.
|
||||
type Space struct {
|
||||
Created string `json:"created"`
|
||||
@@ -354,6 +414,22 @@ type Status struct {
|
||||
// StatusStatus defines model for Status.Status.
|
||||
type StatusStatus string
|
||||
|
||||
// StorageSettings defines model for StorageSettings.
|
||||
type StorageSettings struct {
|
||||
AccessKey string `json:"accessKey"`
|
||||
Bucket string `json:"bucket"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
ForcePathStyle bool `json:"forcePathStyle"`
|
||||
Region string `json:"region"`
|
||||
|
||||
// S3 false stores files on docwell-db's disk
|
||||
S3 bool `json:"s3"`
|
||||
|
||||
// Secret Leave out to keep the stored secret
|
||||
Secret *string `json:"secret,omitempty"`
|
||||
SecretSet *bool `json:"secretSet,omitempty"`
|
||||
}
|
||||
|
||||
// TrashedPage defines model for TrashedPage.
|
||||
type TrashedPage struct {
|
||||
DeletedAt string `json:"deletedAt"`
|
||||
@@ -441,6 +517,11 @@ type WorkspaceMember struct {
|
||||
// WorkspaceRole defines model for WorkspaceRole.
|
||||
type WorkspaceRole string
|
||||
|
||||
// SendTestEmailJSONBody defines parameters for SendTestEmail.
|
||||
type SendTestEmailJSONBody struct {
|
||||
To openapi_types.Email `json:"to"`
|
||||
}
|
||||
|
||||
// LoginWithOtpJSONBody defines parameters for LoginWithOtp.
|
||||
type LoginWithOtpJSONBody struct {
|
||||
Code string `json:"code"`
|
||||
@@ -547,6 +628,12 @@ type CreateSpaceJSONBody struct {
|
||||
Visibility *SpaceVisibility `json:"visibility,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateInstanceSettingsJSONRequestBody defines body for UpdateInstanceSettings for application/json ContentType.
|
||||
type UpdateInstanceSettingsJSONRequestBody = InstanceSettingsUpdate
|
||||
|
||||
// SendTestEmailJSONRequestBody defines body for SendTestEmail for application/json ContentType.
|
||||
type SendTestEmailJSONRequestBody SendTestEmailJSONBody
|
||||
|
||||
// LoginJSONRequestBody defines body for Login for application/json ContentType.
|
||||
type LoginJSONRequestBody = LoginRequest
|
||||
|
||||
|
||||
Reference in new issue
Block a user