Help us shape the future of Go! Take the 2026 Go Developer Survey

settings

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Title                               = "title"
	ShowRecentPads                      = "showRecentPads"
	Favicon                             = "favicon"
	Skinname                            = "skinName"
	SkinVariants                        = "skinVariants"
	IP                                  = "ip"
	Port                                = "port"
	ShowSettingsInAdminPage             = "showSettingsInAdminPage"
	EnableMetrics                       = "enableMetrics"
	CleanupExpr                         = "cleanup"
	CleanupEnabled                      = "cleanup.enabled"
	CleanupKeepRevisions                = "cleanup.keepRevisions"
	AuthenticationMethod                = "authenticationMethod"
	EnableDarkMode                      = "enableDarkMode"
	AvailableExports                    = "availableExports"
	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"
	DBSettingsCollection                = "dbSettings.collection"
	DBSettingsURL                       = "dbSettings.url"
	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"
	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"
	RequireAuthentication               = "requireAuthentication"
	RequireAuthorization                = "requireAuthorization"
	TrustProxy                          = "trustProxy"
	CookieExpr                          = "cookie"
	CookieKeyRotationInterval           = "cookie.keyRotationInterval"
	CookieSameSite                      = "cookie.sameSite"
	CookieSessionLifetime               = "cookie.sessionLifetime"
	CookieSessionRefreshInterval        = "cookie.sessionRefreshInterval"
	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"
)

Variables

This section is empty.

Functions

func GetGitCommit added in v0.0.2

func GetGitCommit(setting *Settings) string

func GitVersion added in v0.0.2

func GitVersion() string

func InitSettings added in v0.0.3

func InitSettings(logger *zap.SugaredLogger)

func StripWithOptions added in v0.0.2

func StripWithOptions(jsonString string, options *Options) string

Types

type Cleanup added in v0.0.2

type Cleanup struct {
	Enabled       bool `json:"enabled"`
	KeepRevisions int  `json:"keepRevisions"`
}

type CommitRateLimiting added in v0.0.2

type CommitRateLimiting struct {
	Duration int  `json:"duration"`
	Points   int  `json:"points"`
	LoadTest bool `json:"loadTest"`
}
type Cookie struct {
	KeyRotationInterval    int64  `json:"keyRotationInterval"`
	SameSite               string `json:"sameSite"`
	SessionLifetime        int64  `json:"sessionLifetime"`
	SessionRefreshInterval int64  `json:"sessionRefreshInterval"`
}

type DBSettings

type DBSettings struct {
	Filename   string
	Host       string
	Port       string
	Database   string
	User       string
	Password   string
	Charset    string
	Collection string
	Url        string
}

type IDBType added in v0.0.2

type IDBType string
const (
	SQLITE   IDBType = "sqlite"
	MEMORY   IDBType = "memory"
	POSTGRES IDBType = "postgres"
	MYSQL    IDBType = "mysql"
)

func ParseDBType added in v0.0.2

func ParseDBType(s string) (IDBType, error)

func (IDBType) String added in v0.0.2

func (dbType IDBType) String() string

type ImportExportRateLimiting added in v0.0.2

type ImportExportRateLimiting struct {
	WindowMS int `json:"windowMS"`
	Max      int `json:"max"`
}

type OidcConfig added in v0.0.2

type OidcConfig struct {
	Authority   string   `json:"authority"`
	ClientId    string   `json:"clientId"`
	JwksUri     string   `json:"jwksUri"`
	RedirectUri string   `json:"redirectUri"`
	Scope       []string `json:"scope"`
}

type Options added in v0.0.2

type Options struct {
	Whitespace     bool
	TrailingCommas bool
}

type PadOptions

type PadOptions struct {
	NoColors         bool
	ShowControls     bool
	ShowChat         bool
	ShowLineNumbers  bool
	UseMonospaceFont bool
	UserName         *bool
	UserColor        *bool
	RTL              bool
	AlwaysShowChat   bool
	ChatAndUsers     bool
	Lang             *string
}

type PadShortcutEnabled added in v0.0.2

type PadShortcutEnabled struct {
	AltF9     bool `json:"altF9"`
	AltC      bool `json:"altC"`
	Delete    bool `json:"delete"`
	CmdShift2 bool `json:"cmdShift2"`
	Return    bool `json:"return"`
	Esc       bool `json:"esc"`
	CmdS      bool `json:"cmdS"`
	Tab       bool `json:"tab"`
	CmdZ      bool `json:"cmdZ"`
	CmdY      bool `json:"cmdY"`
	CmdB      bool `json:"cmdB"`
	CmdI      bool `json:"cmdI"`
	CmdU      bool `json:"cmdU"`
	Cmd5      bool `json:"cmd5"`
	CmdShiftL bool `json:"cmdShiftL"`
	CmdShiftN bool `json:"cmdShiftN"`
	CmdShift1 bool `json:"cmdShift1"`
	CmdShiftC bool `json:"cmdShiftC"`
	CmdH      bool `json:"cmdH"`
	CtrlHome  bool `json:"ctrlHome"`
	PageUp    bool `json:"pageUp"`
	PageDown  bool `json:"pageDown"`
}

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 SSLSettings struct {
	Key  string   `json:"key"`
	Cert string   `json:"cert"`
	Ca   []string `json:"ca"`
}

type SSO added in v0.0.2

type SSO struct {
	Issuer  string      `json:"issuer"`
	Clients []SSOClient `json:"clients"`
}

func (*SSO) GetAdminClient added in v0.0.2

func (s *SSO) GetAdminClient() *SSOClient

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 {
	Root                               string
	SettingsFilename                   string                                         `json:"settingsFilename"`
	CredentialsFilename                string                                         `json:"credentialsFilename"`
	Title                              string                                         `json:"title"`
	ShowRecentPads                     bool                                           `json:"showRecentPads"`
	Favicon                            *string                                        `json:"favicon"`
	TTL                                TTL                                            `json:"ttl"`
	UpdateServer                       string                                         `json:"updateServer"`
	EnableDarkMode                     bool                                           `json:"enableDarkMode"`
	SkinName                           string                                         `json:"skinName"`
	SkinVariants                       string                                         `json:"skinVariants"`
	IP                                 string                                         `json:"ip"`
	Port                               string                                         `json:"port"`
	SuppressErrorsInPadText            bool                                           `json:"suppressErrorsInPadText"`
	SSL                                SSLSettings                                    `json:"ssl"`
	DBType                             IDBType                                        `json:"dbType"`
	DBSettings                         *DBSettings                                    `json:"dbSettings"`
	DefaultPadText                     string                                         `json:"defaultPadText"`
	PadOptions                         PadOptions                                     `json:"padOptions"`
	EnableMetrics                      bool                                           `json:"enableMetrics"`
	PadShortCutEnabled                 PadShortcutEnabled                             `json:"padShortCutEnabled"`
	Toolbar                            Toolbar                                        `json:"toolbar"`
	RequireSession                     bool                                           `json:"requireSession"`
	EditOnly                           bool                                           `json:"editOnly"`
	MaxAge                             int                                            `json:"maxAge"`
	Minify                             bool                                           `json:"minify"`
	Abiword                            *string                                        `json:"abiword"`
	SOffice                            *string                                        `json:"soffice"`
	AllowUnknownFileEnds               bool                                           `json:"allowUnknownFileEnds"`
	LogLevel                           string                                         `json:"logLevel"`
	DisableIPLogging                   bool                                           `json:"disableIPLogging"`
	AutomaticReconnectionTimeout       int                                            `json:"automaticReconnectionTimeout"`
	LoadTest                           bool                                           `json:"loadTest"`
	DumpOnCleanExit                    bool                                           `json:"dumpOnCleanExit"`
	IndentationOnNewLine               bool                                           `json:"indentationOnNewLine"`
	SessionKey                         *string                                        `json:"SessionKey"`
	TrustProxy                         bool                                           `json:"trustProxy"`
	Cookie                             Cookie                                         `json:"cookie"`
	RequireAuthentication              bool                                           `json:"requireAuthentication"`
	RequireAuthorization               bool                                           `json:"requireAuthorization"`
	Users                              map[string]User                                `json:"users"`
	ShowSettingsInAdminPage            bool                                           `json:"showSettingsInAdminPage"`
	ScrollWhenFocusLineIsOutOfViewport clientVars2.ScrollWhenFocusLineIsOutOfViewport `json:"scrollWhenFocusLineIsOutOfViewport"`
	SocketIo                           SocketIoSettings                               `json:"socketIo"`
	AuthenticationMethod               string                                         `json:"authenticationMethod"`
	SSO                                *SSO                                           `json:"sso"`
	Cleanup                            Cleanup                                        `json:"cleanup"`
	ExposeVersion                      bool                                           `json:"exposeVersion"`
	CustomLocaleStrings                map[string]map[string]string                   `json:"customLocaleStrings"`
	ImportExportRateLimiting           ImportExportRateLimiting                       `json:"importExportRateLimiting"`
	CommitRateLimiting                 CommitRateLimiting                             `json:"commitRateLimiting"`
	ImportMaxFileSize                  int64                                          `json:"importMaxFileSize"`
	EnableAdminUITests                 bool                                           `json:"enableAdminUITests"`
	LowerCasePadIDs                    bool                                           `json:"lowerCasePadIds"`
	RandomVersionString                string                                         `json:"randomVersionString"`
	DevMode                            bool                                           `json:"devMode"`
	GitVersion                         string                                         `json:"-"`
	AvailableExports                   []string                                       `json:"availableExports"`
}
var Displayed Settings

func ReadConfig added in v0.0.2

func ReadConfig(jsonStr string) (*Settings, error)

func (*Settings) ExportToExternalToolsAvailable added in v0.0.2

func (s *Settings) ExportToExternalToolsAvailable() string

func (*Settings) GetPublicSettings added in v0.0.2

func (s *Settings) GetPublicSettings() PublicSettings

type SocketIoSettings added in v0.0.2

type SocketIoSettings struct {
	MaxHttpBufferSize int64 `json:"maxHttpBufferSize"`
}

type TTL added in v0.0.2

type TTL struct {
	AccessToken       int
	AuthorizationCode int
	ClientCredentials int
	IdToken           int
	RefreshToken      int
}

type Toolbar

type Toolbar struct {
	Left       [][]string
	Right      [][]string
	TimeSlider [][]string
}

type User

type User struct {
	Password *string `json:"password" mapstructure:"password"`
	IsAdmin  *bool   `json:"is_admin" mapstructure:"is_admin"`
	Username *string `json:"-" mapstructure:"-"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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