Documentation
¶
Index ¶
- Constants
- Variables
- func AnonymizeIP(ip, mode string) string
- func ApplyRegistryDefaults()
- func BuildInfo() (version, releaseID string)
- func EnvVar(key string) string
- func GetGitCommit(setting *Settings) string
- func GitVersion() string
- func HandleConfigCommand(logger *zap.SugaredLogger)
- func InitSettings(logger *zap.SugaredLogger)
- func PrepareSettingsJSON(src []byte) ([]byte, error)
- func RedactSettings(v any) any
- func StripJSONC(src []byte) ([]byte, error)
- type BootstrapAdmin
- type Cleanup
- type Cluster
- type CommitRateLimiting
- type ConfigKey
- type Cookie
- type DBSettings
- type EnvReport
- type GdprAuthorErasure
- type IDBType
- type ImportExportRateLimiting
- type MCP
- type MailAuth
- type MailSettings
- type MaintenanceWindowSettings
- type OidcConfig
- type Options
- type PadOptions
- type PadRetention
- type PadShortcutEnabled
- type PluginPublicSettings
- type PluginSettings
- type PublicSettings
- type SSLSettings
- type SSO
- type SSOClient
- type Settings
- func (s *Settings) BootstrapAdminCredentials() (string, string)
- func (s *Settings) Clustered() bool
- func (s *Settings) GetAllPlugins() []PluginPublicSettings
- func (s *Settings) GetPublicSettings() PublicSettings
- func (s *Settings) IsPluginEnabled(pluginName string) bool
- func (s *Settings) LogIP(ip string) string
- func (s *Settings) ResolvedForAdmin() map[string]any
- type SocialMetaSettings
- type SocketIoSettings
- type TTL
- type TokenPolicy
- type Tokens
- type Toolbar
- type Updates
- type User
Constants ¶
const ( IPLoggingFull = "full" IPLoggingTruncated = "truncated" IPLoggingAnonymous = "anonymous" )
IP logging modes (settings ipLogging, etherpad-lite).
const ( Title = "title" ShowRecentPads = "showRecentPads" Favicon = "favicon" Skinname = "skinName" SkinVariants = "skinVariants" IP = "ip" Port = "port" ShowSettingsInAdminPage = "showSettingsInAdminPage" EnableMetrics = "enableMetrics" ScalingDiveMetrics = "scalingDiveMetrics" CleanupExpr = "cleanup" CleanupEnabled = "cleanup.enabled" CleanupKeepRevisions = "cleanup.keepRevisions" PadRetentionEnabled = "padRetention.enabled" PadRetentionDryRun = "padRetention.dryRun" PadRetentionDeleteAfterDays = "padRetention.deleteAfterDays" PadRetentionWarnBeforeDays = "padRetention.warnBeforeDays" PadRetentionSweepIntervalHours = "padRetention.sweepIntervalHours" PadRetentionExcludeGroupPads = "padRetention.excludeGroupPads" PadRetentionExcludePattern = "padRetention.excludePattern" AuthenticationMethod = "authenticationMethod" EnableDarkMode = "enableDarkMode" EnablePluginPadOptions = "enablePluginPadOptions" EnablePadWideSettings = "enablePadWideSettings" AllowPadDeletionByAllUsers = "allowPadDeletionByAllUsers" SuppressPadDeletionTokenModal = "suppressPadDeletionTokenModal" AvailableExports = "availableExports" IndentationOnNewLine = "indentationOnNewLine" UpdateServer = "updateServer" DBType = "dbType" DBSettingsHost = "dbSettings.host" DBSettingsPort = "dbSettings.port" DBSettingsDatabase = "dbSettings.database" DBSettingsUser = "dbSettings.user" SSLKey = "ssl.key" SSLCert = "ssl.cert" SSLCa = "ssl.ca" DBSettingsPassword = "dbSettings.password" DBSettingsCharset = "dbSettings.charset" DBSettingsFilename = "dbSettings.filename" DBSettingsMaxConnections = "dbSettings.maxConnections" DBSettingsPgBouncer = "dbSettings.pgBouncer" DefaultPadText = "defaultPadText" PadOptionsNoColors = "padOptions.noColors" PadOptionsShowControls = "padOptions.showControls" PadOptionsShowChat = "padOptions.showChat" PadOptionsShowLineNumbers = "padOptions.showLineNumbers" PadOptionsUseMonospaceFont = "padOptions.useMonospaceFont" PadOptionsUserName = "padOptions.userName" PadOptionsUserColor = "padOptions.userColor" PadOptionsRtl = "padOptions.rtl" PadOptionsAlwaysShowChat = "padOptions.alwaysShowChat" PadOptionsChatAndUsers = "padOptions.chatAndUsers" PadOptionsLang = "padOptions.lang" PadOptionsFadeInactiveAuthorColors = "padOptions.fadeInactiveAuthorColors" PadOptionsEnforceReadableAuthorColors = "padOptions.enforceReadableAuthorColors" PadShortcutEnabledAltF9 = "padShortcutEnabled.altF9" PadShortcutEnabledAltC = "padShortcutEnabled.altC" PadShortcutEnabledCmdShift2 = "padShortcutEnabled.cmdShift2" PadShortcutEnabledDelete = "padShortcutEnabled.delete" PadShortcutEnabledReturn = "padShortcutEnabled.return" PadShortcutEnabledEsc = "padShortcutEnabled.esc" PadShortcutEnabledCmdS = "padShortcutEnabled.cmdS" PadShortcutEnabledTab = "padShortcutEnabled.tab" PadShortcutEnabledCmdZ = "padShortcutEnabled.cmdZ" PadShortcutEnabledCmdY = "padShortcutEnabled.cmdY" PadShortcutEnabledCmdI = "padShortcutEnabled.cmdI" PadShortcutEnabledCmdB = "padShortcutEnabled.cmdB" PadShortcutEnabledCmdU = "padShortcutEnabled.cmdU" PadShortcutEnabledCmd5 = "padShortcutEnabled.cmd5" PadShortcutEnabledCmdShiftL = "padShortcutEnabled.cmdShiftL" PadShortcutEnabledCmdShiftN = "padShortcutEnabled.cmdShiftN" PadShortcutEnabledCmdShift1 = "padShortcutEnabled.cmdShift1" PadShortcutEnabledCmdShiftC = "padShortcutEnabled.cmdShiftC" PadShortcutEnabledCmdH = "padShortcutEnabled.cmdH" PadShortcutEnabledCtrlHome = "padShortcutEnabled.ctrlHome" PadShortcutEnabledPageUp = "padShortcutEnabled.pageUp" PadShortcutEnabledPageDown = "padShortcutEnabled.pageDown" SuppressErrorsInPadText = "suppressErrorsInPadText" RequireSession = "requireSession" EditOnly = "editOnly" Minify = "minify" MaxAge = "maxAge" Abiword = "abiword" Soffice = "soffice" AllowUnknownFileEnds = "allowUnknownFileEnds" ExportPdfFonts = "exportPdfFonts" RequireAuthentication = "requireAuthentication" RequireAuthorization = "requireAuthorization" TrustProxy = "trustProxy" CookieExpr = "cookie" ClusterMode = "cluster.mode" ClusterBindAddr = "cluster.bindAddr" ClusterBindPort = "cluster.bindPort" ClusterAdvertiseAddr = "cluster.advertiseAddr" ClusterAdvertisePort = "cluster.advertisePort" ClusterShutdownDelaySeconds = "cluster.shutdownDelaySeconds" CookieKeyRotationInterval = "cookie.keyRotationInterval" CookieSameSite = "cookie.sameSite" CookieSessionLifetime = "cookie.sessionLifetime" CookieSessionRefreshInterval = "cookie.sessionRefreshInterval" UpdatesTier = "updates.tier" UpdatesGithubRepo = "updates.githubRepo" UpdatesCheckIntervalHours = "updates.checkIntervalHours" UpdatesInstallMethod = "updates.installMethod" UpdatesPreApplyGraceMinutes = "updates.preApplyGraceMinutes" UpdatesDrainSeconds = "updates.drainSeconds" UpdatesRollbackHealthCheckSeconds = "updates.rollbackHealthCheckSeconds" UpdatesRequireSignature = "updates.requireSignature" UpdatesTrustedPublicKey = "updates.trustedPublicKey" UpdatesStateFile = "updates.stateFile" AdminEmail = "adminEmail" GdprAuthorErasureEnabled = "gdprAuthorErasure.enabled" MailHost = "mail.host" MailPort = "mail.port" MailSecure = "mail.secure" MailFrom = "mail.from" UpdatesMaintenanceWindowStart = "updates.maintenanceWindow.start" UpdatesMaintenanceWindowEnd = "updates.maintenanceWindow.end" UpdatesMaintenanceWindowTz = "updates.maintenanceWindow.tz" DisableIPlogging = "disableIPlogging" AutomaticReconnectionTimeout = "automaticReconnectionTimeout" ScrollWhenFocusPercentage = "scrollWhenFocusLineIsOutOfViewport.percentage" ScrollWhenFocusEditionAboveViewport = "scrollWhenFocusLineIsOutOfViewport.percentage.editionAboveViewport" ScrollWhenFocusEditionBelowViewport = "scrollWhenFocusLineIsOutOfViewport.percentage.editionBelowViewport" ScrollWhenFocusDuration = "scrollWhenFocusLineIsOutOfViewport.duration" ScrollWhenFocusCaretScroll = "scrollWhenFocusLineIsOutOfViewport.scrollWhenCaretIsInTheLastLineOfViewport" ScrollWhenFocusPercentageArrowUp = "scrollWhenFocusLineIsOutOfViewport.percentageToScrollWhenUserPressesArrowUp" Users = "users" SocketIoMaxHttpBufferSize = "socketIo.maxHttpBufferSize" LoadTest = "loadTest" DumpOnUncleanExit = "dumpOnUncleanExit" ImportExportRateLimitingWindowMs = "importExportRateLimiting.windowMs" ImportExportRateLimitingMax = "importExportRateLimiting.max" ImportMaxFileSize = "importMaxFileSize" CommitRateLimitingDuration = "commitRateLimiting.duration" CommitRateLimitingPoints = "commitRateLimiting.points" ExposeVersion = "exposeVersion" Loglevel = "loglevel" CustomLocaleStrings = "customLocaleStrings" EnableAdminUITests = "enableAdminUITests" LowerCasePadIds = "lowerCasePadIds" DevMode = "devMode" SsoIssuer = "sso.issuer" SsoClients = "sso.clients" // plugins EpAlignEnabled = "plugins.ep_align.enabled" EpSpellcheckEnabled = "plugins.ep_spellcheck.enabled" EpMarkdownEnabled = "plugins.ep_markdown.enabled" EpRSSFeedEnabled = "plugins.ep_rss.enabled" )
const ( // SettingsPathEnv is the server's root: assets, APIKEY.txt and relative // favicon paths are looked up there. SettingsPathEnv = "ETHERPAD_SETTINGS_PATH" // SettingsFileEnv is the settings.json to read and to save from the // admin UI (the Docker image: /data/settings.json, which its // unprivileged user can write). Unset: settings.json in the working // directory. SettingsFileEnv = "ETHERPAD_SETTINGS_FILE" )
const Redacted = "[REDACTED]"
Redacted replaces secret values in settings shown to the admin.
Variables ¶
var Registry = []ConfigKey{}/* 145 elements not displayed */
Functions ¶
func AnonymizeIP ¶ added in v0.7.0
AnonymizeIP is how an IP address appears in logs: "full" keeps it, "truncated" zeroes the last IPv4 octet and keeps the first /48 of an IPv6 address, "anonymous" (and any unknown mode) gives "ANONYMOUS". Something that is no IP address is always "ANONYMOUS".
func ApplyRegistryDefaults ¶ added in v0.0.4
func ApplyRegistryDefaults()
func GetGitCommit ¶ added in v0.0.2
func GitVersion ¶ added in v0.0.2
func GitVersion() string
func HandleConfigCommand ¶ added in v0.0.4
func HandleConfigCommand(logger *zap.SugaredLogger)
func InitSettings ¶ added in v0.0.3
func InitSettings(logger *zap.SugaredLogger)
func PrepareSettingsJSON ¶ added in v0.7.0
PrepareSettingsJSON is what ReadConfig hands viper for a settings file.
func RedactSettings ¶ added in v0.7.0
RedactSettings returns a deep copy of settings (as decoded JSON) with the secrets replaced (etherpad-lite AdminSettingsRedact): users.*.password, passwordHash and hash, bootstrapAdmin.password, dbSettings.password and user, mail.auth.pass, sso.clients[*] client_secret and secret, and sessionKey. Only those exact paths are matched; keys compare case-insensitively since Go's settings struct does not use JSON names everywhere.
func StripJSONC ¶ added in v0.7.0
StripJSONC turns JSON with comments and trailing commas (etherpad-lite's settings.json format) into plain JSON. Strings are copied verbatim, so "//", "/*", ",]" and ",}" inside them survive.
Types ¶
type BootstrapAdmin ¶ added in v0.7.0
type BootstrapAdmin struct {
Username string `json:"username" mapstructure:"username"`
Password string `json:"password" mapstructure:"password"`
}
BootstrapAdmin is the first admin of an instance; see Settings.BootstrapAdmin.
type Cluster ¶ added in v0.7.0
type Cluster struct {
// Mode is "auto" (on for postgres and mysql), "on" or "off".
Mode string `json:"mode" mapstructure:"mode"`
// BindAddr and BindPort are where memberlist listens (TCP and UDP).
BindAddr string `json:"bindAddr" mapstructure:"bindAddr"`
BindPort int `json:"bindPort" mapstructure:"bindPort"`
// AdvertiseAddr is the address other instances reach this one at; by
// default the POD_IP environment variable or a private IP of the host.
AdvertiseAddr string `json:"advertiseAddr" mapstructure:"advertiseAddr"`
AdvertisePort int `json:"advertisePort" mapstructure:"advertisePort"`
// ShutdownDelaySeconds is how long a clustered instance keeps serving
// after SIGTERM while reporting not ready, so the load balancer stops
// sending it new connections before they are closed.
ShutdownDelaySeconds int `json:"shutdownDelaySeconds" mapstructure:"shutdownDelaySeconds"`
}
Cluster configures how several Etherpad instances on one database find each other and pass on live updates (hashicorp/memberlist). The instances register their gossip address in the database, so no further discovery (headless service, DNS) is needed.
func (Cluster) Enabled ¶ added in v0.7.0
Enabled reports whether clustering is on for the given database type.
"auto" turns it on for PostgreSQL and MySQL when the instance runs under an orchestrator that runs several replicas (Kubernetes, or POD_IP given), so an existing single instance on PostgreSQL does not start listening on the gossip port after an upgrade. Elsewhere set mode "on".
type CommitRateLimiting ¶ added in v0.0.2
type Cookie ¶ added in v0.0.2
type Cookie struct {
KeyRotationInterval int64 `json:"keyRotationInterval" mapstructure:"keyRotationInterval"`
Prefix string `json:"prefix" mapstructure:"prefix"`
SameSite string `json:"sameSite" mapstructure:"sameSite"`
SessionLifetime int64 `json:"sessionLifetime" mapstructure:"sessionLifetime"`
SessionRefreshInterval int64 `json:"sessionRefreshInterval" mapstructure:"sessionRefreshInterval"`
// SessionCleanup controls periodic removal of expired/stale sessions.
// Defaults to true. Set to false to disable the cleanup goroutine.
SessionCleanup *bool `json:"sessionCleanup" mapstructure:"sessionCleanup"`
}
type DBSettings ¶
type DBSettings struct {
Filename string `mapstructure:"filename"`
Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
Database string `mapstructure:"database"`
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
Charset string `mapstructure:"charset"`
// MaxConnections caps the query connections per instance (PostgreSQL,
// MySQL); 0 or less means 25.
MaxConnections int `mapstructure:"maxConnections"`
// PgBouncer: PostgreSQL is reached through PgBouncer (or another pooler)
// in transaction mode, so no named prepared statements are used.
PgBouncer bool `mapstructure:"pgBouncer"`
}
type EnvReport ¶ added in v0.7.0
type EnvReport struct {
Unknown []string
}
EnvReport is what applyEnv did not use: names that match no setting.
type GdprAuthorErasure ¶ added in v0.7.0
type GdprAuthorErasure struct {
Enabled bool `json:"enabled" mapstructure:"enabled"`
}
GdprAuthorErasure is the switch of author erasure.
type ImportExportRateLimiting ¶ added in v0.0.2
type MCP ¶ added in v0.7.0
type MCP struct {
// OAuth lets AI clients register themselves and connect with a login
// and the person's consent (claude.ai connectors); default on. Tokens
// pasted by hand work either way.
OAuth *bool `json:"oauth" mapstructure:"oauth"`
}
MCP configures the MCP server (lib/api/mcp).
func (MCP) OAuthEnabled ¶ added in v0.7.0
OAuthEnabled: unset means on.
type MailAuth ¶ added in v0.7.0
type MailAuth struct {
User string `json:"user" mapstructure:"user"`
Pass string `json:"pass" mapstructure:"pass"`
}
MailAuth is a login for the SMTP server.
type MailSettings ¶ added in v0.7.0
type MailSettings struct {
Host string `json:"host" mapstructure:"host"`
// Port defaults to 587 (submission with STARTTLS).
Port int `json:"port" mapstructure:"port"`
// Secure connects with TLS from the start (port 465); otherwise
// STARTTLS is used when the server offers it.
Secure bool `json:"secure" mapstructure:"secure"`
From string `json:"from" mapstructure:"from"`
// Auth is optional: a server that relays without login needs none.
Auth *MailAuth `json:"auth" mapstructure:"auth"`
}
MailSettings is the SMTP server the updater sends its notices through (etherpad-lite's mail). Without a host nothing is sent; the notices only appear in the log.
type MaintenanceWindowSettings ¶ added in v0.6.5
type MaintenanceWindowSettings struct {
Start string `json:"start" mapstructure:"start"`
End string `json:"end" mapstructure:"end"`
TZ string `json:"tz" mapstructure:"tz"`
}
MaintenanceWindowSettings is a daily wall-clock window ("HH:MM" start/end).
type OidcConfig ¶ added in v0.0.2
type PadOptions ¶
type PadOptions struct {
NoColors bool `mapstructure:"noColors"`
ShowControls bool `mapstructure:"showControls"`
ShowChat bool `mapstructure:"showChat"`
ShowLineNumbers bool `mapstructure:"showLineNumbers"`
UseMonospaceFont bool `mapstructure:"useMonospaceFont"`
// UserName and UserColor preset every user's name and colour; nil means
// no preset. Old settings files wrote false for that (see ReadConfig).
UserName *string `mapstructure:"userName"`
UserColor *string `mapstructure:"userColor"`
RTL bool `mapstructure:"rtl"`
AlwaysShowChat bool `mapstructure:"alwaysShowChat"`
ChatAndUsers bool `mapstructure:"chatAndUsers"`
Lang *string `mapstructure:"lang"`
// FadeInactiveAuthorColors fades the background of authors who are no
// longer active. EnforceReadableAuthorColors clamps author backgrounds
// to a shade that keeps the text readable (WCAG AA). Both default to true.
FadeInactiveAuthorColors bool `mapstructure:"fadeInactiveAuthorColors"`
EnforceReadableAuthorColors bool `mapstructure:"enforceReadableAuthorColors"`
}
type PadRetention ¶ added in v0.6.8
type PadRetention struct {
Enabled bool `json:"enabled" mapstructure:"enabled"`
DryRun bool `json:"dryRun" mapstructure:"dryRun"`
DeleteAfterDays int `json:"deleteAfterDays" mapstructure:"deleteAfterDays"`
WarnBeforeDays int `json:"warnBeforeDays" mapstructure:"warnBeforeDays"`
SweepIntervalHours int `json:"sweepIntervalHours" mapstructure:"sweepIntervalHours"`
ExcludeGroupPads bool `json:"excludeGroupPads" mapstructure:"excludeGroupPads"`
ExcludePattern string `json:"excludePattern" mapstructure:"excludePattern"`
}
PadRetention controls automatic removal of inactive pads. It is opt-in and defaults to a dry run so an installation cannot lose data by merely adding the setting to its configuration.
type PadShortcutEnabled ¶ added in v0.0.2
type PadShortcutEnabled struct {
AltF9 bool `json:"altF9" mapstructure:"altF9"`
AltC bool `json:"altC" mapstructure:"altC"`
Delete bool `json:"delete" mapstructure:"delete"`
CmdShift2 bool `json:"cmdShift2" mapstructure:"cmdShift2"`
Return bool `json:"return" mapstructure:"return"`
Esc bool `json:"esc" mapstructure:"esc"`
CmdS bool `json:"cmdS" mapstructure:"cmdS"`
Tab bool `json:"tab" mapstructure:"tab"`
CmdZ bool `json:"cmdZ" mapstructure:"cmdZ"`
CmdY bool `json:"cmdY" mapstructure:"cmdY"`
CmdB bool `json:"cmdB" mapstructure:"cmdB"`
CmdI bool `json:"cmdI" mapstructure:"cmdI"`
CmdU bool `json:"cmdU" mapstructure:"cmdU"`
Cmd5 bool `json:"cmd5" mapstructure:"cmd5"`
CmdShiftL bool `json:"cmdShiftL" mapstructure:"cmdShiftL"`
CmdShiftN bool `json:"cmdShiftN" mapstructure:"cmdShiftN"`
CmdShift1 bool `json:"cmdShift1" mapstructure:"cmdShift1"`
CmdShiftC bool `json:"cmdShiftC" mapstructure:"cmdShiftC"`
CmdH bool `json:"cmdH" mapstructure:"cmdH"`
CtrlHome bool `json:"ctrlHome" mapstructure:"ctrlHome"`
PageUp bool `json:"pageUp" mapstructure:"pageUp"`
PageDown bool `json:"pageDown" mapstructure:"pageDown"`
}
type PluginPublicSettings ¶ added in v0.0.5
type PluginSettings ¶ added in v0.0.4
type PluginSettings struct {
Enabled bool `json:"enabled" mapstructure:"enabled"`
}
PluginSettings definiert die Einstellungen für einzelne Plugins
type PublicSettings ¶ added in v0.0.2
type PublicSettings struct {
GitVersion string `json:"gitVersion"`
Toolbar Toolbar `json:"toolbar"`
ExposeVersion bool `json:"exposeVersion"`
RandomVersionString string `json:"randomVersionString"`
Title string `json:"title"`
SkinName string `json:"skinName"`
SkinVariants string `json:"skinVariants"`
}
type SSLSettings ¶ added in v0.0.2
type SSO ¶ added in v0.0.2
type SSO struct {
Issuer string `json:"issuer" mapstructure:"issuer"`
Clients []SSOClient `json:"clients" mapstructure:"clients"`
}
func (*SSO) GetAdminClient ¶ added in v0.0.2
type SSOClient ¶ added in v0.0.2
type SSOClient struct {
ClientId string `json:"client_id" mapstructure:"client_id"`
ClientSecret *string `json:"client_secret" mapstructure:"client_secret"`
GrantTypes []string `json:"grant_types" mapstructure:"grant_types"`
ResponseTypes []string `json:"response_types" mapstructure:"response_types"`
RedirectUris []string `json:"redirect_uris" mapstructure:"redirect_uris"`
DisplayName string `json:"display_name" mapstructure:"display_name"`
Type string `json:"type" mapstructure:"type"`
}
type Settings ¶
type Settings struct {
Title string `json:"title" mapstructure:"title"`
ShowRecentPads bool `json:"showRecentPads" mapstructure:"showRecentPads"`
Favicon *string `json:"favicon" mapstructure:"favicon"`
// PublicURL: canonical public origin of this Etherpad instance
// (e.g. "https://pad.example.com"). When set, server-rendered
// absolute URLs (currently the Open Graph / Twitter Card og:url
// and og:image) use it unconditionally. When empty, those URLs
// fall back to the request's scheme + Host header with strict
// validation. No trailing slash. Upstream #7635.
PublicURL string `json:"publicURL" mapstructure:"publicURL"`
// SocialMeta carries operator overrides for the Open Graph / Twitter
// Card preview block. Upstream #7691 / #7692.
SocialMeta SocialMetaSettings `json:"socialMeta" mapstructure:"socialMeta"`
TTL TTL `json:"ttl" mapstructure:"ttl"`
UpdateServer string `json:"updateServer" mapstructure:"updateServer"`
EnableDarkMode bool `json:"enableDarkMode" mapstructure:"enableDarkMode"`
// EnablePluginPadOptions: when true, plugin-namespaced keys (matching
// /^ep_[a-z0-9_]+$/) on padOptions are preserved verbatim through the
// pad-wide settings broadcast/persist rail. Default false (opt-in).
// Upstream #7698.
EnablePluginPadOptions bool `json:"enablePluginPadOptions" mapstructure:"enablePluginPadOptions"`
// EnablePadWideSettings lets a pad's creator set chat, view and language
// options for everyone on the pad and enforce them (upstream #7586).
// Default true.
EnablePadWideSettings bool `json:"enablePadWideSettings" mapstructure:"enablePadWideSettings"`
// AllowPadDeletionByAllUsers lets every user who can edit a pad delete
// it. Off: only the pad's creator, or whoever has its deletion token.
AllowPadDeletionByAllUsers bool `json:"allowPadDeletionByAllUsers" mapstructure:"allowPadDeletionByAllUsers"`
// SuppressPadDeletionTokenModal keeps issuing deletion tokens but does
// not interrupt the creator with the "save your token" dialog.
SuppressPadDeletionTokenModal bool `json:"suppressPadDeletionTokenModal" mapstructure:"suppressPadDeletionTokenModal"`
SkinName string `json:"skinName" mapstructure:"skinName"`
SkinVariants string `json:"skinVariants" mapstructure:"skinVariants"`
IP string `json:"ip" mapstructure:"ip"`
Port string `json:"port" mapstructure:"port"`
SuppressErrorsInPadText bool `json:"suppressErrorsInPadText" mapstructure:"suppressErrorsInPadText"`
SSL SSLSettings `json:"ssl" mapstructure:"ssl"`
DBType IDBType `json:"dbType" mapstructure:"dbType"`
DBSettings *DBSettings `json:"dbSettings" mapstructure:"dbSettings"`
DefaultPadText string `json:"defaultPadText" mapstructure:"defaultPadText"`
PadOptions PadOptions `json:"padOptions" mapstructure:"padOptions"`
PadShortcutEnabled PadShortcutEnabled `json:"padShortcutEnabled" mapstructure:"padShortcutEnabled"`
EnableMetrics bool `json:"enableMetrics" mapstructure:"enableMetrics"`
// ScalingDiveMetrics adds the load-test instruments of lib/metrics to
// /metrics (etherpad-lite's scalingDiveMetrics). Off by default: the
// per-pad gauge has one series per open pad.
ScalingDiveMetrics bool `json:"scalingDiveMetrics" mapstructure:"scalingDiveMetrics"`
RequireSession bool `json:"requireSession" mapstructure:"requireSession"`
EditOnly bool `json:"editOnly" mapstructure:"editOnly"`
MaxAge int `json:"maxAge" mapstructure:"maxAge"`
Minify bool `json:"minify" mapstructure:"minify"`
AllowUnknownFileEnds bool `json:"allowUnknownFileEnds" mapstructure:"allowUnknownFileEnds"`
// ExportPdfFonts gives font files for font families of the PDF export
// (etherpad-lite's setting): family -> file, or family -> {regular,
// bold, italic, boldItalic, fallback}. Relative paths are relative to
// the root. See lib/io/exportPDF_fonts.go.
ExportPdfFonts map[string]any `json:"exportPdfFonts" mapstructure:"exportPdfFonts"`
LogLevel string `json:"loglevel" mapstructure:"loglevel"`
// DisableIPLogging is the old switch; IPLogging replaces it (see
// ReadConfig) and is what LogIP uses.
DisableIPLogging bool `json:"disableIPLogging" mapstructure:"disableIPLogging"`
// IPLogging is how client IP addresses appear in logs: "anonymous"
// (default), "truncated" or "full".
IPLogging string `json:"ipLogging" mapstructure:"ipLogging"`
AutomaticReconnectionTimeout int `json:"automaticReconnectionTimeout" mapstructure:"automaticReconnectionTimeout"`
LoadTest bool `json:"loadTest" mapstructure:"loadTest"`
DumpOnCleanExit bool `json:"dumpOnUncleanExit" mapstructure:"dumpOnUncleanExit"`
TrustProxy bool `json:"trustProxy" mapstructure:"trustProxy"`
Cookie Cookie `json:"cookie" mapstructure:"cookie"`
Updates Updates `json:"updates" mapstructure:"updates"`
// AdminEmail receives the updater's notices (outdated instance, a
// scheduled update, a failed one); "" sends none.
AdminEmail string `json:"adminEmail" mapstructure:"adminEmail"`
// GdprAuthorErasure enables erasing authors (GDPR Art. 17) in the HTTP
// API (anonymizeAuthor) and the admin page; off by default.
GdprAuthorErasure GdprAuthorErasure `json:"gdprAuthorErasure" mapstructure:"gdprAuthorErasure"`
Mail MailSettings `json:"mail" mapstructure:"mail"`
Cluster Cluster `json:"cluster" mapstructure:"cluster"`
RequireAuthentication bool `json:"requireAuthentication" mapstructure:"requireAuthentication"`
RequireAuthorization bool `json:"requireAuthorization" mapstructure:"requireAuthorization"`
// Users is etherpad-lite's user list. It is taken over into the
// account management (lib/accounts) once, on the first start with it,
// and not read afterwards.
Users map[string]User `json:"users" mapstructure:"users"`
// BootstrapAdmin creates the first admin account while there is none
// (also EP_BOOTSTRAP_ADMIN_USER and EP_BOOTSTRAP_ADMIN_PASSWORD).
BootstrapAdmin BootstrapAdmin `json:"bootstrapAdmin" mapstructure:"bootstrapAdmin"`
// Tokens are the rules for tokens: whether they must expire and how
// long they may live, for people and for service accounts.
Tokens Tokens `json:"tokens" mapstructure:"tokens"`
// MCP configures the MCP server at /mcp (AI clients).
MCP MCP `json:"mcp" mapstructure:"mcp"`
ShowSettingsInAdminPage bool `json:"showSettingsInAdminPage" mapstructure:"showSettingsInAdminPage"`
ScrollWhenFocusLineIsOutOfViewport clientVars2.ScrollWhenFocusLineIsOutOfViewport `json:"scrollWhenFocusLineIsOutOfViewport" mapstructure:"scrollWhenFocusLineIsOutOfViewport"`
SocketIo SocketIoSettings `json:"socketIo" mapstructure:"socketIo"`
AuthenticationMethod string `json:"authenticationMethod" mapstructure:"authenticationMethod"`
SSO *SSO `json:"sso" mapstructure:"sso"`
Toolbar Toolbar `json:"toolbar" mapstructure:"toolbar"`
Cleanup Cleanup `json:"cleanup" mapstructure:"cleanup"`
PadRetention PadRetention `json:"padRetention" mapstructure:"padRetention"`
ExposeVersion bool `json:"exposeVersion" mapstructure:"exposeVersion"`
CustomLocaleStrings map[string]map[string]string `json:"customLocaleStrings" mapstructure:"customLocaleStrings"`
ImportExportRateLimiting ImportExportRateLimiting `json:"importExportRateLimiting" mapstructure:"importExportRateLimiting"`
CommitRateLimiting CommitRateLimiting `json:"commitRateLimiting" mapstructure:"commitRateLimiting"`
ImportMaxFileSize int64 `json:"importMaxFileSize" mapstructure:"importMaxFileSize"`
EnableAdminUITests bool `json:"enableAdminUITests" mapstructure:"enableAdminUITests"`
LowerCasePadIDs bool `json:"lowerCasePadIds" mapstructure:"lowerCasePadIds"`
DevMode bool `json:"devMode" mapstructure:"devMode"`
AvailableExports []string `json:"availableExports" mapstructure:"availableExports"`
IndentationOnNewLine bool `json:"indentationOnNewLine" mapstructure:"indentationOnNewLine"`
Plugins map[string]PluginSettings `json:"plugins" mapstructure:"plugins"`
// Untracked fields
Root string `json:"-"`
// SettingsFile is the settings.json read at start ("" for none) and
// SettingsSaveFile the one the admin UI saves to (settingsFiles).
SettingsFile string `json:"-" mapstructure:"-"`
SettingsSaveFile string `json:"-" mapstructure:"-"`
GitVersion string `json:"-"`
RandomVersionString string `json:"-"`
}
var Displayed Settings
func ReadConfig ¶ added in v0.0.2
func (*Settings) BootstrapAdminCredentials ¶ added in v0.7.0
BootstrapAdminCredentials returns the bootstrap admin, the environment variables EP_BOOTSTRAP_ADMIN_USER and EP_BOOTSTRAP_ADMIN_PASSWORD before the settings.
func (*Settings) Clustered ¶ added in v0.7.0
Clustered reports whether several instances may share this database, so state that only lives in one process (settings.json edits, self-updates) must not be changed through a single instance.
func (*Settings) GetAllPlugins ¶ added in v0.0.5
func (s *Settings) GetAllPlugins() []PluginPublicSettings
func (*Settings) GetPublicSettings ¶ added in v0.0.2
func (s *Settings) GetPublicSettings() PublicSettings
func (*Settings) IsPluginEnabled ¶ added in v0.0.4
func (*Settings) LogIP ¶ added in v0.7.0
LogIP is the client IP address as it may appear in a log line.
func (*Settings) ResolvedForAdmin ¶ added in v0.7.0
ResolvedForAdmin is the live settings as the admin page shows them: JSON-shaped, with the secrets redacted.
type SocialMetaSettings ¶ added in v0.6.0
type SocialMetaSettings struct {
// Description: when non-empty, used verbatim for og:description /
// twitter:description regardless of negotiated language. Most preview
// crawlers (WhatsApp, Signal, Slack, ...) do not send Accept-Language
// and otherwise always see the English fallback from the i18n catalog.
//
// Type is `any` (not `string`) because viper/mapstructure may yield
// number or boolean when the value comes from an env-var-driven
// settings.json (e.g. SOCIAL_META_DESCRIPTION="2026" -> number,
// ="true" -> bool). The renderer stringifies before use; empty /
// whitespace values are treated as unset so an accidental "" doesn't
// silently blank out previews. Upstream #7692.
Description any `json:"description" mapstructure:"description"`
}
SocialMetaSettings holds operator overrides for Open Graph / Twitter Card preview metadata. Upstream #7691 / #7692.
type SocketIoSettings ¶ added in v0.0.2
type SocketIoSettings struct {
MaxHttpBufferSize int64 `json:"maxHttpBufferSize" mapstructure:"maxHttpBufferSize"`
}
type TokenPolicy ¶ added in v0.7.0
type TokenPolicy struct {
// RequireExpiry: no token lives for ever ("never" is refused).
RequireExpiry bool `json:"requireExpiry" mapstructure:"requireExpiry"`
// MaxLifetimeDays is the longest a token may live, from its issue or
// its last change of expiry; 0 means no maximum.
MaxLifetimeDays int `json:"maxLifetimeDays" mapstructure:"maxLifetimeDays"`
}
TokenPolicy is how long tokens of one kind of account may live.
type Tokens ¶ added in v0.7.0
type Tokens struct {
Personal TokenPolicy `json:"personal" mapstructure:"personal"`
Service TokenPolicy `json:"service" mapstructure:"service"`
}
Tokens are the rules for the accounts' tokens (lib/tokens): for the personal tokens of people and for those of service accounts.
type Updates ¶ added in v0.6.5
type Updates struct {
// Tier: off | notify | manual | auto | autonomous.
Tier string `json:"tier" mapstructure:"tier"`
// GithubRepo to poll for releases, e.g. "ether/etherpad-go".
GithubRepo string `json:"githubRepo" mapstructure:"githubRepo"`
// CheckIntervalHours between release checks.
CheckIntervalHours int `json:"checkIntervalHours" mapstructure:"checkIntervalHours"`
// InstallMethod: auto | binary | docker | managed.
InstallMethod string `json:"installMethod" mapstructure:"installMethod"`
// PreApplyGraceMinutes between scheduling and applying an auto update.
PreApplyGraceMinutes int `json:"preApplyGraceMinutes" mapstructure:"preApplyGraceMinutes"`
// DrainSeconds to block new connections before swapping the binary.
DrainSeconds int `json:"drainSeconds" mapstructure:"drainSeconds"`
// RollbackHealthCheckSeconds to wait for a healthy boot before rolling back.
RollbackHealthCheckSeconds int `json:"rollbackHealthCheckSeconds" mapstructure:"rollbackHealthCheckSeconds"`
// RequireSignature enforces ed25519 verification of the checksums file.
RequireSignature bool `json:"requireSignature" mapstructure:"requireSignature"`
// TrustedPublicKey is the base64-encoded ed25519 public key used when
// RequireSignature is true.
TrustedPublicKey string `json:"trustedPublicKey" mapstructure:"trustedPublicKey"`
// StateFile path for the persisted update state.
StateFile string `json:"stateFile" mapstructure:"stateFile"`
// MaintenanceWindow restricts autonomous applies to a daily wall-clock window.
MaintenanceWindow MaintenanceWindowSettings `json:"maintenanceWindow" mapstructure:"maintenanceWindow"`
}
Updates configures the self-update subsystem (lib/updater).
type User ¶
type User struct {
Password *string `json:"password" mapstructure:"password"`
IsAdmin *bool `json:"is_admin" mapstructure:"is_admin"`
Username *string `json:"username" mapstructure:"username"`
// ReadOnly makes every pad read-only for this user. CanCreate=false
// keeps the user from creating pads (unset means allowed). Both as in
// etherpad-lite's settings.users.
ReadOnly *bool `json:"readOnly,omitempty" mapstructure:"readOnly"`
CanCreate *bool `json:"canCreate,omitempty" mapstructure:"canCreate"`
}