Documentation ¶
Overview ¶
Package config provides global options, command-line flags, and user settings.
Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.
This program is free software: you can redistribute it and/or modify it under Version 3 of the GNU Affero General Public License (the "AGPL"): <https://docs.photoprism.app/license/agpl> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. The AGPL is supplemented by our Trademark and Brand Guidelines, which describe how our Brand Assets may be used: <https://www.photoprism.app/trademark>
Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.
Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>
Index ¶
- Constants
- Variables
- func ApplyCliContext(c interface{}, ctx *cli.Context) error
- func CliTestContext() *cli.Context
- func Env(vars ...string) bool
- func EnvVar(flag string) string
- func FlushCache()
- func LogErr(err error)
- func Register(name string, initConfig func(c *Config) error, ...)
- func SetNewTestConfig()
- type CategoryLabel
- type CategoryLabels
- type CliFlag
- type CliFlags
- func (f CliFlags) Cli() (result []cli.Flag)
- func (f CliFlags) Find(tags []string) (result []cli.Flag)
- func (f CliFlags) Insert(name string, insert []CliFlag) (result CliFlags)
- func (f CliFlags) Prepend(el []CliFlag) (result CliFlags)
- func (f CliFlags) Remove(names []string) (result CliFlags)
- func (f CliFlags) Replace(name string, replacement CliFlag) CliFlags
- func (f CliFlags) Report() (rows [][]string, cols []string)
- type ClientAssets
- type ClientConfig
- type ClientCounts
- type ClientDisable
- type ClientPosition
- type ClientType
- type Config
- func (c *Config) About() string
- func (c *Config) AdminPassword() string
- func (c *Config) AdminUser() string
- func (c *Config) AlbumsPath() string
- func (c *Config) ApiUri() string
- func (c *Config) AppColor() string
- func (c *Config) AppConfig() pwa.Config
- func (c *Config) AppIcon() string
- func (c *Config) AppIconsPath(name ...string) string
- func (c *Config) AppManifest() *pwa.Manifest
- func (c *Config) AppMode() string
- func (c *Config) AppName() string
- func (c *Config) AssetsPath() string
- func (c *Config) Auth() bool
- func (c *Config) AuthMode() string
- func (c *Config) AutoImport() time.Duration
- func (c *Config) AutoIndex() time.Duration
- func (c *Config) BackupPath() string
- func (c *Config) BackupYaml() bool
- func (c *Config) BaseUri(res string) string
- func (c *Config) BuildPath() string
- func (c *Config) CORSHeaders() string
- func (c *Config) CORSMethods() string
- func (c *Config) CORSOrigin() string
- func (c *Config) CachePath() string
- func (c *Config) CaseInsensitive() (result bool, err error)
- func (c *Config) CdnDomain() string
- func (c *Config) CdnUrl(res string) string
- func (c *Config) CdnVideo() bool
- func (c *Config) CertificatesPath() string
- func (c *Config) CheckPassword(p string) bool
- func (c *Config) CliContext() *cli.Context
- func (c *Config) CliGlobalString(name string) string
- func (c *Config) ClientAssets() ClientAssets
- func (c *Config) ClientManifestUri() string
- func (c *Config) ClientPublic() ClientConfig
- func (c *Config) ClientRole(role acl.Role) ClientConfig
- func (c *Config) ClientSession(sess *entity.Session) (cfg ClientConfig)
- func (c *Config) ClientShare() ClientConfig
- func (c *Config) ClientUser(withSettings bool) ClientConfig
- func (c *Config) CloseDb() error
- func (c *Config) CmdCachePath() string
- func (c *Config) CmdLibPath() string
- func (c *Config) ConfigPath() string
- func (c *Config) ContentUri() string
- func (c *Config) Copyright() string
- func (c *Config) CreateDarktableCachePath() (string, error)
- func (c *Config) CreateDarktableConfigPath() (string, error)
- func (c *Config) CreateDirectories() error
- func (c *Config) CustomAssetsPath() string
- func (c *Config) CustomStaticAssetUri(res string) string
- func (c *Config) CustomStaticFile(fileName string) string
- func (c *Config) CustomStaticPath() string
- func (c *Config) CustomStaticUri() string
- func (c *Config) CustomTemplatesPath() string
- func (c *Config) DarktableBin() string
- func (c *Config) DarktableBlacklist() string
- func (c *Config) DarktableCachePath() string
- func (c *Config) DarktableConfigPath() string
- func (c *Config) DarktableEnabled() bool
- func (c *Config) DatabaseConns() int
- func (c *Config) DatabaseConnsIdle() int
- func (c *Config) DatabaseDriver() string
- func (c *Config) DatabaseDsn() string
- func (c *Config) DatabaseFile() string
- func (c *Config) DatabaseHost() string
- func (c *Config) DatabaseName() string
- func (c *Config) DatabasePassword() string
- func (c *Config) DatabasePort() int
- func (c *Config) DatabasePortString() string
- func (c *Config) DatabaseServer() string
- func (c *Config) DatabaseUser() string
- func (c *Config) Db() *gorm.DB
- func (c *Config) Debug() bool
- func (c *Config) DefaultLocale() string
- func (c *Config) DefaultTLS() bool
- func (c *Config) DefaultTheme() string
- func (c *Config) DefaultsYaml() string
- func (c *Config) Demo() bool
- func (c *Config) DetachServer() bool
- func (c *Config) DetectNSFW() bool
- func (c *Config) DisableBackups() bool
- func (c *Config) DisableClassification() bool
- func (c *Config) DisableDarktable() bool
- func (c *Config) DisableExifTool() bool
- func (c *Config) DisableFFmpeg() bool
- func (c *Config) DisableFaces() bool
- func (c *Config) DisableHeifConvert() bool
- func (c *Config) DisableImageMagick() bool
- func (c *Config) DisableJpegXL() bool
- func (c *Config) DisablePlaces() bool
- func (c *Config) DisableRaw() bool
- func (c *Config) DisableRawTherapee() bool
- func (c *Config) DisableRestart() bool
- func (c *Config) DisableRsvgConvert() bool
- func (c *Config) DisableSettings() bool
- func (c *Config) DisableSips() bool
- func (c *Config) DisableTLS() bool
- func (c *Config) DisableTensorFlow() bool
- func (c *Config) DisableVectors() bool
- func (c *Config) DisableWebDAV() bool
- func (c *Config) DownloadTestData() error
- func (c *Config) DownloadToken() string
- func (c *Config) Edition() string
- func (c *Config) ExamplesPath() string
- func (c *Config) ExifBruteForce() bool
- func (c *Config) ExifToolBin() string
- func (c *Config) ExifToolEnabled() bool
- func (c *Config) ExifToolJson() bool
- func (c *Config) Experimental() bool
- func (c *Config) FFmpegBin() string
- func (c *Config) FFmpegBitrate() int
- func (c *Config) FFmpegBitrateExceeded(mbit float64) bool
- func (c *Config) FFmpegEnabled() bool
- func (c *Config) FFmpegEncoder() ffmpeg.AvcEncoder
- func (c *Config) FFmpegMapAudio() string
- func (c *Config) FFmpegMapVideo() string
- func (c *Config) FFmpegOptions(encoder ffmpeg.AvcEncoder, bitrate string) (ffmpeg.Options, error)
- func (c *Config) FFmpegSize() int
- func (c *Config) FaceClusterCore() int
- func (c *Config) FaceClusterDist() float64
- func (c *Config) FaceClusterScore() int
- func (c *Config) FaceClusterSize() int
- func (c *Config) FaceMatchDist() float64
- func (c *Config) FaceNetModelPath() string
- func (c *Config) FaceOverlap() int
- func (c *Config) FaceScore() float64
- func (c *Config) FaceSize() int
- func (c *Config) Flags() (flags []string)
- func (c *Config) GeoApi() string
- func (c *Config) HeifConvertBin() string
- func (c *Config) HeifConvertEnabled() bool
- func (c *Config) HttpCacheMaxAge() ttl.Duration
- func (c *Config) HttpCachePublic() bool
- func (c *Config) HttpCompression() string
- func (c *Config) HttpHost() string
- func (c *Config) HttpMode() string
- func (c *Config) HttpPort() int
- func (c *Config) HttpSocket() string
- func (c *Config) HttpVideoMaxAge() ttl.Duration
- func (c *Config) HttpsProxy() string
- func (c *Config) HttpsProxyInsecure() bool
- func (c *Config) Hub() *hub.Config
- func (c *Config) HubConfigFile() string
- func (c *Config) ImageMagickBin() string
- func (c *Config) ImageMagickBlacklist() string
- func (c *Config) ImageMagickEnabled() bool
- func (c *Config) ImgPath() string
- func (c *Config) ImportDest() string
- func (c *Config) ImportPath() string
- func (c *Config) ImportSQL(filename string)
- func (c *Config) Init() error
- func (c *Config) InitDb()
- func (c *Config) InitSerial() (err error)
- func (c *Config) InitTestDb()
- func (c *Config) InitializeTestData() (err error)
- func (c *Config) InvalidDownloadToken(t string) bool
- func (c *Config) InvalidPreviewToken(t string) bool
- func (c *Config) JpegQuality() thumb.Quality
- func (c *Config) JpegSize() int
- func (c *Config) JpegXLDecoderBin() string
- func (c *Config) JpegXLEnabled() bool
- func (c *Config) LegalInfo() string
- func (c *Config) LegalUrl() string
- func (c *Config) LocalesPath() string
- func (c *Config) LogFilename() string
- func (c *Config) LogLevel() logrus.Level
- func (c *Config) LoginUri() string
- func (c *Config) MariadbBin() string
- func (c *Config) MariadbDumpBin() string
- func (c *Config) MediaCachePath() string
- func (c *Config) MediaFileCachePath(hash string) string
- func (c *Config) MigrateDb(runFailed bool, ids []string)
- func (c *Config) NSFWModelPath() string
- func (c *Config) Name() string
- func (c *Config) NoCdn() bool
- func (c *Config) Options() *Options
- func (c *Config) OptionsYaml() string
- func (c *Config) OriginalsAlbumsPath() string
- func (c *Config) OriginalsByteLimit() int64
- func (c *Config) OriginalsDeletable() bool
- func (c *Config) OriginalsLimit() int
- func (c *Config) OriginalsPath() string
- func (c *Config) PIDFilename() string
- func (c *Config) ParseDatabaseDsn()
- func (c *Config) PasswordLength() int
- func (c *Config) PasswordResetUri() string
- func (c *Config) PngSize() int
- func (c *Config) PreviewToken() string
- func (c *Config) Prod() bool
- func (c *Config) Propagate()
- func (c *Config) ProxyProtoHeader() []string
- func (c *Config) ProxyProtoHeaders() map[string]string
- func (c *Config) ProxyProtoHttps() []string
- func (c *Config) Public() bool
- func (c *Config) PublicSettings() *customize.Settings
- func (c *Config) RawEnabled() bool
- func (c *Config) RawPresets() bool
- func (c *Config) RawTherapeeBin() string
- func (c *Config) RawTherapeeBlacklist() string
- func (c *Config) RawTherapeeEnabled() bool
- func (c *Config) ReadOnly() bool
- func (c *Config) RegisterDb()
- func (c *Config) RegisterUri() string
- func (c *Config) RemoveTestData() error
- func (c *Config) RenewApiKeys()
- func (c *Config) RenewApiKeysWithToken(token string) error
- func (c *Config) Report() (rows [][]string, cols []string)
- func (c *Config) ResolutionLimit() int
- func (c *Config) Restart() bool
- func (c *Config) RsvgConvertBin() string
- func (c *Config) RsvgConvertEnabled() bool
- func (c *Config) Serial() string
- func (c *Config) SerialChecksum() string
- func (c *Config) SessionMaxAge() int64
- func (c *Config) SessionSettings(sess *entity.Session) *customize.Settings
- func (c *Config) SessionTimeout() int64
- func (c *Config) SetAuthMode(mode string)
- func (c *Config) SetDbOptions()
- func (c *Config) SetLogLevel(level logrus.Level)
- func (c *Config) SetWallpaperUri(uri string) *Config
- func (c *Config) Settings() *customize.Settings
- func (c *Config) SettingsYaml() string
- func (c *Config) SettingsYamlDefaults(settingsYml string) string
- func (c *Config) ShareSettings() *customize.Settings
- func (c *Config) Shutdown()
- func (c *Config) SidecarPath() string
- func (c *Config) SidecarPathIsAbs() bool
- func (c *Config) SidecarWritable() bool
- func (c *Config) SipsBin() string
- func (c *Config) SipsBlacklist() string
- func (c *Config) SipsEnabled() bool
- func (c *Config) SiteAuthor() string
- func (c *Config) SiteCaption() string
- func (c *Config) SiteDescription() string
- func (c *Config) SiteDomain() string
- func (c *Config) SiteHttps() bool
- func (c *Config) SitePreview() string
- func (c *Config) SiteTitle() string
- func (c *Config) SiteUrl() string
- func (c *Config) Sponsor() bool
- func (c *Config) SqliteBin() string
- func (c *Config) StaticAssetUri(res string) string
- func (c *Config) StaticFile(fileName string) string
- func (c *Config) StaticPath() string
- func (c *Config) StaticUri() string
- func (c *Config) StoragePath() string
- func (c *Config) TLS() (publicCert, privateKey string)
- func (c *Config) TLSCert() string
- func (c *Config) TLSEmail() string
- func (c *Config) TLSKey() string
- func (c *Config) TempPath() string
- func (c *Config) TemplateExists(name string) bool
- func (c *Config) TemplateFiles() []string
- func (c *Config) TemplateName() string
- func (c *Config) TemplatesPath() string
- func (c *Config) TensorFlowModelPath() string
- func (c *Config) TensorFlowVersion() string
- func (c *Config) Test() bool
- func (c *Config) TestdataPath() string
- func (c *Config) ThumbCachePath() string
- func (c *Config) ThumbColor() string
- func (c *Config) ThumbFilter() thumb.ResampleFilter
- func (c *Config) ThumbSRGB() bool
- func (c *Config) ThumbSizePrecached() int
- func (c *Config) ThumbSizeUncached() int
- func (c *Config) ThumbUncached() bool
- func (c *Config) Trace() bool
- func (c *Config) TrustedProxies() []string
- func (c *Config) TrustedProxy() string
- func (c *Config) Unsafe() bool
- func (c *Config) UnzipTestData() error
- func (c *Config) UploadNSFW() bool
- func (c *Config) UseCdn() bool
- func (c *Config) UserAgent() string
- func (c *Config) UserStoragePath(userUid string) string
- func (c *Config) UserUploadPath(userUid, token string) (string, error)
- func (c *Config) UsersOriginalsPath() string
- func (c *Config) UsersPath() string
- func (c *Config) UsersStoragePath() string
- func (c *Config) VectorEnabled() bool
- func (c *Config) Version() string
- func (c *Config) VersionChecksum() uint32
- func (c *Config) VideoUri() string
- func (c *Config) WakeupInterval() time.Duration
- func (c *Config) WallpaperUri() string
- func (c *Config) Workers() int
- type DSN
- type Extension
- type Extensions
- type Map
- type Options
- type ThumbSize
- type ThumbSizes
- type Years
Constants ¶
const ( AuthModePublic = "public" AuthModePasswd = "password" )
const ( CacheKeyAppManifest = "app-manifest" CacheKeyWallpaperUri = "wallpaper-uri" )
const ( Pro = "pro" Plus = "plus" Essentials = "essentials" )
Product feature tags used to automatically generate documentation.
const ( MySQL = "mysql" MariaDB = "mariadb" Postgres = "postgres" SQLite3 = "sqlite3" )
SQL Databases. TODO: PostgresSQL support requires upgrading GORM, so generic column data types can be used.
const ( SQLiteTestDB = ".test.db" SQLiteMemoryDSN = ":memory:" )
SQLite default DSNs.
const ( HttpModeProd = "release" HttpModeDebug = "debug" )
const ( PrivateKeyExt = ".key" PublicCertExt = ".crt" )
const ( EnvProd = "prod" EnvUnsafe = "unsafe" EnvDebug = "debug" EnvTrace = "trace" EnvDemo = "demo" EnvSponsor = "sponsor" EnvTest = "test" )
Environment names.
const ( TestDataZip = "/tmp/photoprism/testdata.zip" TestDataURL = "https://dl.photoprism.app/qa/testdata.zip" TestDataHash = "be394d5bee8a5634d415e9e0663eef20b5604510" // sha1sum )
Download URL and ZIP hash for test files.
const ApiUri = "/api/v1"
ApiUri is the relative path for handling REST requests.
const CustomStaticUri = "/c/static"
CustomStaticUri is the relative path for serving custom static content.
const DefaultAutoImportDelay = int(3 * 60) // 3 Minutes
const DefaultAutoIndexDelay = int(5 * 60) // 5 Minutes
DefaultAutoIndexDelay and DefaultAutoImportDelay set the default safety delay duration before starting to index/import in the background.
const DefaultResolutionLimit = 150 // 150 Megapixels
DefaultResolutionLimit defines the default resolution limit.
const DefaultSessionMaxAge = UnixWeek * 2
DefaultSessionMaxAge is the default session expiration time in seconds.
const DefaultSessionTimeout = UnixWeek
DefaultSessionTimeout is the default session timeout time in seconds.
const DefaultWakeupInterval = time.Second * time.Duration(DefaultWakeupIntervalSeconds)
const DefaultWakeupIntervalSeconds = int(15 * 60) // 15 Minutes
const Gigabyte = Megabyte * 1000 // 1,000,000,000 Bytes
Gigabyte in bytes.
const MaxWakeupInterval = time.Hour * 24 // 1 Day
const Megabyte = 1000 * 1000 // 1,000,000 Bytes
Megabyte in bytes.
const MinMem = Gigabyte
MinMem is the minimum amount of system memory required.
const MinWakeupInterval = time.Minute // 1 Minute
MinWakeupInterval and MaxWakeupInterval limit the interval duration in which the background worker can be invoked.
const RecommendedMem = 3 * Gigabyte // 3,000,000,000 Bytes
RecommendedMem is the recommended amount of system memory.
const StaticUri = "/static"
StaticUri is the relative path for serving static content.
const UnixDay = UnixHour * 24
UnixDay is one day in UnixTime.
const UnixHour int64 = 3600
UnixHour is one hour in UnixTime.
const UnixWeek = UnixDay * 7
UnixWeek is one week in UnixTime.
Variables ¶
var ( SignUpURL = "https://www.photoprism.app/membership" MsgSponsor = "Become a member today, support our mission and enjoy our member benefits! 💎" MsgSignUp = "Visit " + SignUpURL + " to learn more." SignUp = Map{"message": MsgSponsor, "url": SignUpURL} )
var (
ErrReadOnly = errors.New("not available in read-only mode")
)
var Flags = CliFlags{}/* 141 elements not displayed */
Flags configures the global command-line interface (CLI) parameters.
var LowMem = false
var PkgNameRegexp = regexp.MustCompile("[^a-zA-Z\\-_]+")
var Sponsor = Env(EnvDemo, EnvSponsor, EnvTest)
var TotalMem uint64
Functions ¶
func ApplyCliContext ¶
ApplyCliContext applies the values of the cli context based on the "flag" annotations.
func CliTestContext ¶
CliTestContext returns a CLI context for testing.
func Register ¶
func Register(name string, initConfig func(c *Config) error, clientConfig func(c *Config, t ClientType) Map)
Register registers a new package extension.
func SetNewTestConfig ¶
func SetNewTestConfig()
Types ¶
type CategoryLabel ¶
type CategoryLabels ¶
type CategoryLabels []CategoryLabel
type CliFlag ¶
type CliFlag struct { Flag cli.DocGenerationFlag Tags []string }
CliFlag represents a command-line parameter.
func (CliFlag) CommandFlag ¶
CommandFlag returns the full command flag based on the name.
type CliFlags ¶
type CliFlags []CliFlag
CliFlags represents a list of command-line parameters.
type ClientAssets ¶
type ClientAssets struct { BaseUri string `json:"-"` AppCss string `json:"app.css"` AppJs string `json:"app.js"` MaterialIconsRegularTtf string `json:"MaterialIcons-Regular.ttf"` MaterialIconsRegularWoff string `json:"MaterialIcons-Regular.woff"` MaterialIconsRegularEot string `json:"MaterialIcons-Regular.eot"` MaterialIconsRegularWoff2 string `json:"MaterialIcons-Regular.woff2"` OfflineServiceworker string `json:"__offline_serviceworker"` DefaultSkinSvg string `json:"default-skin.svg"` PreloaderGif string `json:"preloader.gif"` DefaultSkinPng string `json:"default-skin.png"` }
func NewClientAssets ¶
func NewClientAssets(baseUri string) ClientAssets
NewClientAssets creates a new ClientAssets instance.
func (*ClientAssets) AppCssUri ¶
func (a *ClientAssets) AppCssUri() string
AppCssUri returns the web app stylesheet URI.
func (*ClientAssets) AppJsUri ¶
func (a *ClientAssets) AppJsUri() string
AppJsUri returns the web app javascript URI.
func (*ClientAssets) Load ¶
func (a *ClientAssets) Load(fileName string) error
Load loads the frontend assets from a webpack manifest file.
func (*ClientAssets) ShareCssUri ¶
func (a *ClientAssets) ShareCssUri() string
ShareCssUri returns the web sharing stylesheet URI.
func (*ClientAssets) ShareJsUri ¶
func (a *ClientAssets) ShareJsUri() string
ShareJsUri returns the web sharing javascript URI.
type ClientConfig ¶
type ClientConfig struct { Mode string `json:"mode"` Name string `json:"name"` About string `json:"about"` Edition string `json:"edition"` Version string `json:"version"` Copyright string `json:"copyright"` Flags string `json:"flags"` BaseUri string `json:"baseUri"` StaticUri string `json:"staticUri"` CssUri string `json:"cssUri"` JsUri string `json:"jsUri"` ManifestUri string `json:"manifestUri"` ApiUri string `json:"apiUri"` ContentUri string `json:"contentUri"` VideoUri string `json:"videoUri"` WallpaperUri string `json:"wallpaperUri"` SiteUrl string `json:"siteUrl"` SiteDomain string `json:"siteDomain"` SiteAuthor string `json:"siteAuthor"` SiteTitle string `json:"siteTitle"` SiteCaption string `json:"siteCaption"` SiteDescription string `json:"siteDescription"` SitePreview string `json:"sitePreview"` LegalInfo string `json:"legalInfo"` LegalUrl string `json:"legalUrl"` AppName string `json:"appName"` AppMode string `json:"appMode"` AppIcon string `json:"appIcon"` AppColor string `json:"appColor"` Restart bool `json:"restart"` Debug bool `json:"debug"` Trace bool `json:"trace"` Test bool `json:"test"` Demo bool `json:"demo"` Sponsor bool `json:"sponsor"` ReadOnly bool `json:"readonly"` UploadNSFW bool `json:"uploadNSFW"` Public bool `json:"public"` AuthMode string `json:"authMode"` UsersPath string `json:"usersPath"` LoginUri string `json:"loginUri"` RegisterUri string `json:"registerUri"` PasswordLength int `json:"passwordLength"` PasswordResetUri string `json:"passwordResetUri"` Experimental bool `json:"experimental"` AlbumCategories []string `json:"albumCategories"` Albums entity.Albums `json:"albums"` Cameras entity.Cameras `json:"cameras"` Lenses entity.Lenses `json:"lenses"` Countries entity.Countries `json:"countries"` People entity.People `json:"people"` Thumbs ThumbSizes `json:"thumbs"` Tier int `json:"tier"` Membership string `json:"membership"` Customer string `json:"customer"` MapKey string `json:"mapKey"` DownloadToken string `json:"downloadToken,omitempty"` PreviewToken string `json:"previewToken,omitempty"` Disable ClientDisable `json:"disable"` Count ClientCounts `json:"count"` Pos ClientPosition `json:"pos"` Years Years `json:"years"` Colors []map[string]string `json:"colors"` Categories CategoryLabels `json:"categories"` Clip int `json:"clip"` Server env.Resources `json:"server"` Settings *customize.Settings `json:"settings,omitempty"` ACL acl.Grants `json:"acl,omitempty"` Ext Map `json:"ext"` }
ClientConfig represents HTTP client / Web UI config options.
func (ClientConfig) ApplyACL ¶
func (c ClientConfig) ApplyACL(a acl.ACL, r acl.Role) ClientConfig
ApplyACL updates the client config values based on the ACL and Role provided.
type ClientCounts ¶
type ClientCounts struct { All int `json:"all"` Photos int `json:"photos"` Live int `json:"live"` Videos int `json:"videos"` Cameras int `json:"cameras"` Lenses int `json:"lenses"` Countries int `json:"countries"` Hidden int `json:"hidden"` Archived int `json:"archived"` Favorites int `json:"favorites"` Review int `json:"review"` Stories int `json:"stories"` Private int `json:"private"` Albums int `json:"albums"` PrivateAlbums int `json:"private_albums"` Moments int `json:"moments"` PrivateMoments int `json:"private_moments"` Months int `json:"months"` PrivateMonths int `json:"private_months"` States int `json:"states"` PrivateStates int `json:"private_states"` Folders int `json:"folders"` PrivateFolders int `json:"private_folders"` Files int `json:"files"` People int `json:"people"` Places int `json:"places"` Labels int `json:"labels"` LabelMaxPhotos int `json:"labelMaxPhotos"` }
ClientCounts represents photo, video and album counts for the client UI.
type ClientDisable ¶
type ClientDisable struct { WebDAV bool `json:"webdav"` Settings bool `json:"settings"` Places bool `json:"places"` Backups bool `json:"backups"` TensorFlow bool `json:"tensorflow"` Faces bool `json:"faces"` Classification bool `json:"classification"` Sips bool `json:"sips"` FFmpeg bool `json:"ffmpeg"` ExifTool bool `json:"exiftool"` Darktable bool `json:"darktable"` RawTherapee bool `json:"rawtherapee"` ImageMagick bool `json:"imagemagick"` HeifConvert bool `json:"heifconvert"` Vectors bool `json:"vectors"` JpegXL bool `json:"jpegxl"` Raw bool `json:"raw"` }
ClientDisable represents disabled client features a user cannot turn back on.
type ClientPosition ¶
type ClientType ¶
type ClientType string
const ( ClientPublic ClientType = "public" ClientUser ClientType = "user" )
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds database, cache and all parameters of photoprism
func NewTestConfig ¶
NewTestConfig returns a valid test config.
func NewTestErrorConfig ¶
func NewTestErrorConfig() *Config
NewTestErrorConfig returns an invalid test config.
func TestConfig ¶
func TestConfig() *Config
TestConfig returns the existing test config instance or creates a new instance and returns it.
func (*Config) AdminPassword ¶
AdminPassword returns the initial admin password.
func (*Config) AlbumsPath ¶
AlbumsPath returns the storage path for album YAML files.
func (*Config) AppIconsPath ¶
AppIconsPath returns the path to the app icons.
func (*Config) AppManifest ¶
AppManifest returns the progressive web app manifest.
func (*Config) AssetsPath ¶
AssetsPath returns the path to static assets for models and templates.
func (*Config) AutoImport ¶
AutoImport returns the auto import delay duration.
func (*Config) BackupPath ¶
BackupPath returns the backup storage path.
func (*Config) BackupYaml ¶
BackupYaml checks if creating YAML files is enabled.
func (*Config) CORSHeaders ¶
CORSHeaders returns the value for the Access-Control-Allow-Headers header, if any.
func (*Config) CORSMethods ¶
CORSMethods returns the value for the Access-Control-Allow-Methods header, if any.
func (*Config) CORSOrigin ¶
CORSOrigin returns the value for the Access-Control-Allow-Origin header, if any.
func (*Config) CaseInsensitive ¶
CaseInsensitive checks if the storage path is case-insensitive.
func (*Config) CdnUrl ¶
CdnUrl returns the optional content delivery network URI without trailing slash.
func (*Config) CertificatesPath ¶
CertificatesPath returns the path to the TLS certificates and keys.
func (*Config) CheckPassword ¶
CheckPassword compares given password p with the admin password
func (*Config) CliContext ¶
CliContext returns the cli context if set.
func (*Config) CliGlobalString ¶
CliGlobalString returns a global cli string flag value if set.
func (*Config) ClientAssets ¶
func (c *Config) ClientAssets() ClientAssets
ClientAssets returns the frontend build assets.
func (*Config) ClientManifestUri ¶
ClientManifestUri returns the frontend manifest.json URI.
func (*Config) ClientPublic ¶
func (c *Config) ClientPublic() ClientConfig
ClientPublic returns config values for use by the JavaScript UI and other clients.
func (*Config) ClientRole ¶
func (c *Config) ClientRole(role acl.Role) ClientConfig
ClientRole provides the client config values for the specified user role.
func (*Config) ClientSession ¶
func (c *Config) ClientSession(sess *entity.Session) (cfg ClientConfig)
ClientSession provides the client config values for the specified session.
func (*Config) ClientShare ¶
func (c *Config) ClientShare() ClientConfig
ClientShare returns reduced client config values for share link visitors.
func (*Config) ClientUser ¶
func (c *Config) ClientUser(withSettings bool) ClientConfig
ClientUser returns complete client config values for users with full access.
func (*Config) CmdCachePath ¶
CmdCachePath returns a path that external CLI tools can use as cache directory.
func (*Config) CmdLibPath ¶
CmdLibPath returns the dynamic loader path that external CLI tools should use.
func (*Config) ConfigPath ¶
ConfigPath returns the config path.
func (*Config) ContentUri ¶
ContentUri returns the content delivery URI.
func (*Config) CreateDarktableCachePath ¶
CreateDarktableCachePath creates and returns the darktable cache directory.
func (*Config) CreateDarktableConfigPath ¶
CreateDarktableConfigPath creates and returns the darktable config directory.
func (*Config) CreateDirectories ¶
CreateDirectories creates directories for storing photos, metadata and cache files.
func (*Config) CustomAssetsPath ¶
CustomAssetsPath returns the path to custom assets such as icons, models and translations.
func (*Config) CustomStaticAssetUri ¶
CustomStaticAssetUri returns the resource URI of the custom static file asset.
func (*Config) CustomStaticFile ¶
CustomStaticFile returns the path to a custom static file.
func (*Config) CustomStaticPath ¶
CustomStaticPath returns the custom static assets' path.
func (*Config) CustomStaticUri ¶
CustomStaticUri returns the URI to a custom static resource.
func (*Config) CustomTemplatesPath ¶
CustomTemplatesPath returns the path to custom templates.
func (*Config) DarktableBin ¶
DarktableBin returns the darktable-cli executable file name.
func (*Config) DarktableBlacklist ¶
DarktableBlacklist returns the darktable file extension blacklist.
func (*Config) DarktableCachePath ¶
DarktableCachePath returns the darktable cache directory.
func (*Config) DarktableConfigPath ¶
DarktableConfigPath returns the darktable config directory.
func (*Config) DarktableEnabled ¶
DarktableEnabled checks if Darktable is enabled for RAW conversion.
func (*Config) DatabaseConns ¶
DatabaseConns returns the maximum number of open connections to the database.
func (*Config) DatabaseConnsIdle ¶
DatabaseConnsIdle returns the maximum number of idle connections to the database (equal or less than open).
func (*Config) DatabaseDriver ¶
DatabaseDriver returns the database driver name.
func (*Config) DatabaseDsn ¶
DatabaseDsn returns the database data source name (DSN).
func (*Config) DatabaseFile ¶
DatabaseFile returns the filename part of a sqlite database DSN.
func (*Config) DatabaseHost ¶
DatabaseHost the database server host.
func (*Config) DatabaseName ¶
DatabaseName the database schema name.
func (*Config) DatabasePassword ¶
DatabasePassword returns the database user password.
func (*Config) DatabasePort ¶
DatabasePort the database server port.
func (*Config) DatabasePortString ¶
DatabasePortString the database server port as string.
func (*Config) DatabaseServer ¶
DatabaseServer the database server.
func (*Config) DatabaseUser ¶
DatabaseUser returns the database user name.
func (*Config) DefaultLocale ¶
DefaultLocale returns the default user interface language locale name.
func (*Config) DefaultTLS ¶
DefaultTLS checks if a self-signed certificate should be used to enable HTTPS if no other certificate is available.
func (*Config) DefaultTheme ¶
DefaultTheme returns the default user interface theme name.
func (*Config) DefaultsYaml ¶
DefaultsYaml returns the default options YAML filename.
func (*Config) DetachServer ¶
DetachServer checks if server should detach from console (daemon mode).
func (*Config) DetectNSFW ¶
DetectNSFW checks if NSFW photos should be detected and flagged.
func (*Config) DisableBackups ¶
DisableBackups checks if photo and album metadata files should be disabled.
func (*Config) DisableClassification ¶
DisableClassification checks if image classification is disabled.
func (*Config) DisableDarktable ¶
DisableDarktable checks if conversion of RAW images with Darktable is disabled.
func (*Config) DisableExifTool ¶
DisableExifTool checks if ExifTool JSON files should not be created for improved metadata extraction.
func (*Config) DisableFFmpeg ¶
DisableFFmpeg checks if FFmpeg is disabled for video transcoding.
func (*Config) DisableFaces ¶
DisableFaces checks if face recognition is disabled.
func (*Config) DisableHeifConvert ¶
DisableHeifConvert checks if heif-convert is disabled for HEIF conversion.
func (*Config) DisableImageMagick ¶
DisableImageMagick checks if conversion of files with ImageMagick is disabled.
func (*Config) DisableJpegXL ¶
DisableJpegXL checks if JPEG XL file format support is disabled.
func (*Config) DisablePlaces ¶
DisablePlaces checks if geocoding and maps should be disabled.
func (*Config) DisableRaw ¶
DisableRaw checks if indexing and conversion of RAW images is disabled.
func (*Config) DisableRawTherapee ¶
DisableRawTherapee checks if conversion of RAW images with RawTherapee is disabled.
func (*Config) DisableRestart ¶
DisableRestart checks if users should not be allowed to restart the server from the user interface.
func (*Config) DisableRsvgConvert ¶
DisableRsvgConvert checks if rsvg-convert is disabled for SVG conversion.
func (*Config) DisableSettings ¶
DisableSettings checks if users should not be allowed to change settings.
func (*Config) DisableSips ¶
DisableSips checks if conversion of RAW images with SIPS is disabled.
func (*Config) DisableTLS ¶
DisableTLS checks if HTTPS should be disabled even if the site URL starts with https:// and a certificate is available.
func (*Config) DisableTensorFlow ¶
DisableTensorFlow checks if all features depending on TensorFlow should be disabled.
func (*Config) DisableVectors ¶
DisableVectors checks if vector graphics support is disabled.
func (*Config) DisableWebDAV ¶
DisableWebDAV checks if the built-in WebDAV server should be disabled.
func (*Config) DownloadTestData ¶
DownloadTestData downloads the test files from the file server.
func (*Config) DownloadToken ¶
DownloadToken returns the DOWNLOAD api token (you can optionally use a static value for permanent caching).
func (*Config) ExamplesPath ¶
ExamplesPath returns the example files path.
func (*Config) ExifBruteForce ¶
ExifBruteForce checks if a brute-force search should be performed when no Exif headers were found.
func (*Config) ExifToolBin ¶
ExifToolBin returns the exiftool executable file name.
func (*Config) ExifToolEnabled ¶
ExifToolEnabled checks if the use of ExifTool is possible.
func (*Config) ExifToolJson ¶
ExifToolJson checks if creating JSON metadata sidecar files with Exiftool is enabled.
func (*Config) Experimental ¶
Experimental checks if experimental features should be enabled.
func (*Config) FFmpegBitrate ¶
FFmpegBitrate returns the ffmpeg bitrate limit in MBit/s.
func (*Config) FFmpegBitrateExceeded ¶
FFmpegBitrateExceeded tests if the ffmpeg bitrate limit is exceeded.
func (*Config) FFmpegEnabled ¶
FFmpegEnabled checks if FFmpeg is enabled for video transcoding.
func (*Config) FFmpegEncoder ¶
func (c *Config) FFmpegEncoder() ffmpeg.AvcEncoder
FFmpegEncoder returns the FFmpeg AVC encoder name.
func (*Config) FFmpegMapAudio ¶
FFmpegMapAudio returns the audio streams to be transcoded as string.
func (*Config) FFmpegMapVideo ¶
FFmpegMapVideo returns the video streams to be transcoded as string.
func (*Config) FFmpegOptions ¶
FFmpegOptions returns the FFmpeg transcoding options.
func (*Config) FFmpegSize ¶
FFmpegSize returns the maximum ffmpeg video encoding size in pixels (720-7680).
func (*Config) FaceClusterCore ¶
FaceClusterCore returns the number of faces forming a cluster core.
func (*Config) FaceClusterDist ¶
FaceClusterDist returns the radius of faces forming a cluster core.
func (*Config) FaceClusterScore ¶
FaceClusterScore returns the quality threshold for faces forming a cluster.
func (*Config) FaceClusterSize ¶
FaceClusterSize returns the size threshold for faces forming a cluster in pixels.
func (*Config) FaceMatchDist ¶
FaceMatchDist returns the offset distance when matching faces with clusters.
func (*Config) FaceNetModelPath ¶
FaceNetModelPath returns the FaceNet model path.
func (*Config) FaceOverlap ¶
FaceOverlap returns the face area overlap threshold in percent.
func (*Config) HeifConvertBin ¶
HeifConvertBin returns the heif-convert executable file name.
func (*Config) HeifConvertEnabled ¶
HeifConvertEnabled checks if heif-convert is enabled for HEIF conversion.
func (*Config) HttpCacheMaxAge ¶
HttpCacheMaxAge returns the time in seconds until cached content expires.
func (*Config) HttpCachePublic ¶
HttpCachePublic checks whether static content may be cached by a CDN or caching proxy.
func (*Config) HttpCompression ¶
HttpCompression returns the http compression method (gzip, or none).
func (*Config) HttpHost ¶
HttpHost returns the built-in HTTP server host name or IP address (empty for all interfaces).
func (*Config) HttpSocket ¶
HttpSocket tries to parse the HttpHost as a Unix socket path and returns an empty string otherwise.
func (*Config) HttpVideoMaxAge ¶
HttpVideoMaxAge returns the time in seconds until cached videos expire.
func (*Config) HttpsProxy ¶
HttpsProxy returns the HTTPS proxy to use for outgoing connections.
func (*Config) HttpsProxyInsecure ¶
HttpsProxyInsecure checks if invalid TLS certificates should be ignored when using the configured HTTPS proxy.
func (*Config) HubConfigFile ¶
HubConfigFile returns the backend api config file name.
func (*Config) ImageMagickBin ¶
ImageMagickBin returns the ImageMagick "convert" executable file name.
func (*Config) ImageMagickBlacklist ¶
ImageMagickBlacklist returns the ImageMagick file extension blacklist.
func (*Config) ImageMagickEnabled ¶
ImageMagickEnabled checks if ImageMagick can be used for converting media files.
func (*Config) ImportDest ¶
ImportDest returns the relative originals path to which the files should be imported by default.
func (*Config) ImportPath ¶
ImportPath returns the import directory.
func (*Config) Init ¶
Init creates directories, parses additional config files, opens a database connection and initializes dependencies.
func (*Config) InitDb ¶
func (c *Config) InitDb()
InitDb initializes the database without running previously failed migrations.
func (*Config) InitSerial ¶
InitSerial initializes storage directories with a random serial.
func (*Config) InitTestDb ¶
func (c *Config) InitTestDb()
InitTestDb drops all tables in the currently configured database and re-creates them.
func (*Config) InitializeTestData ¶
InitializeTestData resets the test file directory.
func (*Config) InvalidDownloadToken ¶
InvalidDownloadToken checks if the token is invalid.
func (*Config) InvalidPreviewToken ¶
InvalidPreviewToken checks if the preview token is invalid.
func (*Config) JpegQuality ¶
JpegQuality returns the jpeg image quality as thumb.Quality (25-100).
func (*Config) JpegSize ¶
JpegSize returns the size limit for automatically converted files in `PIXELS` (720-30000).
func (*Config) JpegXLDecoderBin ¶
JpegXLDecoderBin returns the JPEG XL decoder executable file name.
func (*Config) JpegXLEnabled ¶
JpegXLEnabled checks if JPEG XL file format support is enabled.
func (*Config) LocalesPath ¶
LocalesPath returns the translation locales path.
func (*Config) LogFilename ¶
LogFilename returns the filename for storing server logs.
func (*Config) MariadbBin ¶
MariadbBin returns the mariadb executable file name.
func (*Config) MariadbDumpBin ¶
MariadbDumpBin returns the mariadb-dump executable file name.
func (*Config) MediaCachePath ¶
MediaCachePath returns the main media cache path.
func (*Config) MediaFileCachePath ¶
MediaFileCachePath returns the cache subdirectory path for a given file hash.
func (*Config) NSFWModelPath ¶
NSFWModelPath returns the "not safe for work" TensorFlow model path.
func (*Config) NoCdn ¶
NoCdn checks if there is no Content Deliver Network (CDN) configured to serve static content.
func (*Config) OptionsYaml ¶
OptionsYaml returns the config options YAML filename.
func (*Config) OriginalsAlbumsPath ¶
OriginalsAlbumsPath returns the optional album YAML file path inside originals.
func (*Config) OriginalsByteLimit ¶
OriginalsByteLimit returns the maximum size of originals in bytes.
func (*Config) OriginalsDeletable ¶
OriginalsDeletable checks if originals can be deleted.
func (*Config) OriginalsLimit ¶
OriginalsLimit returns the maximum size of originals in MB.
func (*Config) OriginalsPath ¶
OriginalsPath returns the originals.
func (*Config) PIDFilename ¶
PIDFilename returns the filename for storing the server process id (pid).
func (*Config) ParseDatabaseDsn ¶
func (c *Config) ParseDatabaseDsn()
ParseDatabaseDsn parses the database dsn and extracts user, password, database server, and name.
func (*Config) PasswordLength ¶
PasswordLength returns the minimum password length in characters.
func (*Config) PasswordResetUri ¶
PasswordResetUri returns the password reset page URI, if any.
func (*Config) PngSize ¶
PngSize returns the size limit for automatically converted files in `PIXELS` (720-30000).
func (*Config) PreviewToken ¶
PreviewToken returns the preview image api token (based on the unique storage serial by default).
func (*Config) Propagate ¶
func (c *Config) Propagate()
Propagate updates config options in other packages as needed.
func (*Config) ProxyProtoHeader ¶
ProxyProtoHeader returns the proxy protocol header names.
func (*Config) ProxyProtoHeaders ¶
ProxyProtoHeaders returns a map with the proxy https protocol headers.
func (*Config) ProxyProtoHttps ¶
ProxyProtoHttps returns the proxy protocol header HTTPS values.
func (*Config) PublicSettings ¶
PublicSettings returns the public app settings.
func (*Config) RawEnabled ¶
RawEnabled checks if indexing and conversion of RAW images is enabled.
func (*Config) RawPresets ¶
RawPresets checks if RAW converter presents should be used (may reduce performance).
func (*Config) RawTherapeeBin ¶
RawTherapeeBin returns the rawtherapee-cli executable file name.
func (*Config) RawTherapeeBlacklist ¶
RawTherapeeBlacklist returns the RawTherapee file extension blacklist.
func (*Config) RawTherapeeEnabled ¶
RawTherapeeEnabled checks if RawTherapee is enabled for RAW conversion.
func (*Config) RegisterDb ¶
func (c *Config) RegisterDb()
RegisterDb sets the database options and connection provider.
func (*Config) RegisterUri ¶
RegisterUri returns the user registration page URI, if any.
func (*Config) RemoveTestData ¶
RemoveTestData deletes files in import, export, originals, and cache folders.
func (*Config) RenewApiKeys ¶
func (c *Config) RenewApiKeys()
RenewApiKeys renews the api credentials for maps and places.
func (*Config) RenewApiKeysWithToken ¶
RenewApiKeysWithToken renews the api credentials for maps and places with an activation token.
func (*Config) ResolutionLimit ¶
ResolutionLimit returns the maximum resolution of originals in megapixels (width x height).
func (*Config) Restart ¶
Restart checks if the application should be restarted, e.g. after an update or a config changes.
func (*Config) RsvgConvertBin ¶
RsvgConvertBin returns the rsvg-convert executable file name.
func (*Config) RsvgConvertEnabled ¶
RsvgConvertEnabled checks if rsvg-convert is enabled for SVG conversion.
func (*Config) SerialChecksum ¶
SerialChecksum returns the CRC32 checksum of the storage serial.
func (*Config) SessionMaxAge ¶
SessionMaxAge returns the time in seconds until API sessions expire automatically.
func (*Config) SessionSettings ¶
SessionSettings returns the app settings for the specified session.
func (*Config) SessionTimeout ¶
SessionTimeout returns the time in seconds until API sessions expire due to inactivity
func (*Config) SetAuthMode ¶
SetAuthMode changes the authentication mode (for use in tests only).
func (*Config) SetDbOptions ¶
func (c *Config) SetDbOptions()
SetDbOptions sets the database collation to unicode if supported.
func (*Config) SetLogLevel ¶
SetLogLevel sets the Logrus log level.
func (*Config) SetWallpaperUri ¶
SetWallpaperUri changes the login screen background image URI.
func (*Config) SettingsYaml ¶
SettingsYaml returns the settings YAML filename.
func (*Config) SettingsYamlDefaults ¶
SettingsYamlDefaults returns the default settings YAML filename.
func (*Config) ShareSettings ¶
ShareSettings returns the app settings for share link visitors.
func (*Config) SidecarPath ¶
SidecarPath returns the storage path for generated sidecar files (relative or absolute).
func (*Config) SidecarPathIsAbs ¶
SidecarPathIsAbs checks if sidecar path is absolute.
func (*Config) SidecarWritable ¶
SidecarWritable checks if sidecar files can be created.
func (*Config) SipsBlacklist ¶
SipsBlacklist returns the Sips file extension blacklist.
func (*Config) SipsEnabled ¶
SipsEnabled checks if SIPS is enabled for RAW conversion.
func (*Config) SiteAuthor ¶
SiteAuthor returns the site author / copyright.
func (*Config) SiteCaption ¶
SiteCaption returns a short site caption.
func (*Config) SiteDescription ¶
SiteDescription returns a long site description.
func (*Config) SiteDomain ¶
SiteDomain returns the public server domain.
func (*Config) SitePreview ¶
SitePreview returns the site preview image URL for sharing.
func (*Config) SiteUrl ¶
SiteUrl returns the public server URL (default is "http://localhost:2342/").
func (*Config) StaticAssetUri ¶
StaticAssetUri returns the resource URI of the static file asset.
func (*Config) StaticFile ¶
StaticFile returns the path to a static file.
func (*Config) StaticPath ¶
StaticPath returns the static assets' path.
func (*Config) StoragePath ¶
StoragePath returns the path for generated files like cache and index.
func (*Config) TLSEmail ¶
TLSEmail returns the email address to enable automatic HTTPS via Let's Encrypt
func (*Config) TempPath ¶
TempPath returns the cached temporary directory name e.g. for uploads and downloads.
func (*Config) TemplateExists ¶
TemplateExists checks if a template with the given name exists (e.g. index.gohtml).
func (*Config) TemplateFiles ¶
TemplateFiles returns the file paths of all templates found.
func (*Config) TemplateName ¶
TemplateName returns the name of the default template (e.g. index.gohtml).
func (*Config) TemplatesPath ¶
TemplatesPath returns the server templates path.
func (*Config) TensorFlowModelPath ¶
TensorFlowModelPath returns the TensorFlow model path.
func (*Config) TensorFlowVersion ¶
TensorFlowVersion returns the TenorFlow framework version.
func (*Config) TestdataPath ¶
TestdataPath returns the test files path.
func (*Config) ThumbCachePath ¶
ThumbCachePath returns the thumbnail storage path.
func (*Config) ThumbColor ¶
ThumbColor returns the color profile name for thumbnails.
func (*Config) ThumbFilter ¶
func (c *Config) ThumbFilter() thumb.ResampleFilter
ThumbFilter returns the thumbnail resample filter (best to worst: blackman, lanczos, cubic or linear).
func (*Config) ThumbSRGB ¶
ThumbSRGB checks if colors should be normalized to standard RGB in thumbnails.
func (*Config) ThumbSizePrecached ¶
ThumbSizePrecached returns the pre-cached thumbnail size limit in pixels (720-7680).
func (*Config) ThumbSizeUncached ¶
ThumbSizeUncached returns the on-demand rendering size limit in pixels (720-7680).
func (*Config) ThumbUncached ¶
ThumbUncached checks if on-demand thumbnail rendering is enabled (high memory and cpu usage).
func (*Config) TrustedProxies ¶
TrustedProxies returns proxy server ranges from which reverse proxy headers can be trusted.
func (*Config) TrustedProxy ¶
TrustedProxy returns the ranges from which reverse proxy headers can be trusted as comma-separated list.
func (*Config) UnzipTestData ¶
UnzipTestData extracts tests files from the zip archive.
func (*Config) UploadNSFW ¶
UploadNSFW checks if NSFW photos can be uploaded.
func (*Config) UseCdn ¶
UseCdn checks if a Content Deliver Network (CDN) is used to serve static content.
func (*Config) UserAgent ¶
UserAgent returns an HTTP user agent string based on the app config and version.
func (*Config) UserStoragePath ¶
UserStoragePath returns the storage path for user assets.
func (*Config) UserUploadPath ¶
UserUploadPath returns the upload path for the specified user.
func (*Config) UsersOriginalsPath ¶
UsersOriginalsPath returns the users originals base path.
func (*Config) UsersStoragePath ¶
UsersStoragePath returns the users storage base path.
func (*Config) VectorEnabled ¶
VectorEnabled checks if indexing and conversion of vector graphics is enabled.
func (*Config) VersionChecksum ¶
VersionChecksum returns the application version checksum.
func (*Config) WakeupInterval ¶
WakeupInterval returns the duration between background worker runs required for face recognition and index maintenance(1-86400s).
func (*Config) WallpaperUri ¶
WallpaperUri returns the login screen background image URI.
type DSN ¶
type DSN struct { Driver string User string Password string Net string Server string Name string Params string }
DSN represents parts of a data source name.
type Extension ¶
type Extension struct {
// contains filtered or unexported fields
}
Extension represents a named package extension with callbacks.
type Extensions ¶
type Extensions []Extension
Extensions represents a list of package extensions.
func (Extensions) Init ¶
func (ext Extensions) Init(c *Config)
Init initializes the registered extensions.
type Map ¶
type Map map[string]interface{}
Map is an alias for map[string]interface{}.
func ClientExt ¶
func ClientExt(c *Config, t ClientType) Map
ClientExt returns optional client config values by namespace.
type Options ¶
type Options struct { Name string `json:"-"` About string `json:"-"` Edition string `json:"-"` Version string `json:"-"` Copyright string `json:"-"` PartnerID string `yaml:"-" json:"-" flag:"partner-id"` AuthMode string `yaml:"AuthMode" json:"-" flag:"auth-mode"` Public bool `yaml:"Public" json:"-" flag:"public"` AdminUser string `yaml:"AdminUser" json:"-" flag:"admin-user"` AdminPassword string `yaml:"AdminPassword" json:"-" flag:"admin-password"` PasswordLength int `yaml:"PasswordLength" json:"-" flag:"password-length"` PasswordResetUri string `yaml:"PasswordResetUri" json:"-" flag:"password-reset-uri"` RegisterUri string `yaml:"RegisterUri" json:"-" flag:"register-uri"` LoginUri string `yaml:"LoginUri" json:"-" flag:"login-uri"` SessionMaxAge int64 `yaml:"SessionMaxAge" json:"-" flag:"session-maxage"` SessionTimeout int64 `yaml:"SessionTimeout" json:"-" flag:"session-timeout"` LogLevel string `yaml:"LogLevel" json:"-" flag:"log-level"` Prod bool `yaml:"Prod" json:"Prod" flag:"prod"` Debug bool `yaml:"Debug" json:"Debug" flag:"debug"` Trace bool `yaml:"Trace" json:"Trace" flag:"trace"` Test bool `yaml:"-" json:"Test,omitempty" flag:"test"` Unsafe bool `yaml:"-" json:"-" flag:"unsafe"` Demo bool `yaml:"-" json:"-" flag:"demo"` Sponsor bool `yaml:"-" json:"-" flag:"sponsor"` ConfigPath string `yaml:"ConfigPath" json:"-" flag:"config-path"` DefaultsYaml string `json:"-" yaml:"-" flag:"defaults-yaml"` OriginalsPath string `yaml:"OriginalsPath" json:"-" flag:"originals-path"` OriginalsLimit int `yaml:"OriginalsLimit" json:"OriginalsLimit" flag:"originals-limit"` ResolutionLimit int `yaml:"ResolutionLimit" json:"ResolutionLimit" flag:"resolution-limit"` UsersPath string `yaml:"UsersPath" json:"-" flag:"users-path"` StoragePath string `yaml:"StoragePath" json:"-" flag:"storage-path"` SidecarPath string `yaml:"SidecarPath" json:"-" flag:"sidecar-path"` BackupPath string `yaml:"BackupPath" json:"-" flag:"backup-path"` CachePath string `yaml:"CachePath" json:"-" flag:"cache-path"` ImportPath string `yaml:"ImportPath" json:"-" flag:"import-path"` ImportDest string `yaml:"ImportDest" json:"-" flag:"import-dest"` AssetsPath string `yaml:"AssetsPath" json:"-" flag:"assets-path"` CustomAssetsPath string `yaml:"-" json:"-" flag:"custom-assets-path"` TempPath string `yaml:"TempPath" json:"-" flag:"temp-path"` Workers int `yaml:"Workers" json:"Workers" flag:"workers"` WakeupInterval time.Duration `yaml:"WakeupInterval" json:"WakeupInterval" flag:"wakeup-interval"` AutoIndex int `yaml:"AutoIndex" json:"AutoIndex" flag:"auto-index"` AutoImport int `yaml:"AutoImport" json:"AutoImport" flag:"auto-import"` ReadOnly bool `yaml:"ReadOnly" json:"ReadOnly" flag:"read-only"` Experimental bool `yaml:"Experimental" json:"Experimental" flag:"experimental"` DisableSettings bool `yaml:"DisableSettings" json:"-" flag:"disable-settings"` DisableRestart bool `yaml:"DisableRestart" json:"-" flag:"disable-restart"` DisableBackups bool `yaml:"DisableBackups" json:"DisableBackups" flag:"disable-backups"` DisableWebDAV bool `yaml:"DisableWebDAV" json:"DisableWebDAV" flag:"disable-webdav"` DisablePlaces bool `yaml:"DisablePlaces" json:"DisablePlaces" flag:"disable-places"` DisableTensorFlow bool `yaml:"DisableTensorFlow" json:"DisableTensorFlow" flag:"disable-tensorflow"` DisableFaces bool `yaml:"DisableFaces" json:"DisableFaces" flag:"disable-faces"` DisableClassification bool `yaml:"DisableClassification" json:"DisableClassification" flag:"disable-classification"` DisableFFmpeg bool `yaml:"DisableFFmpeg" json:"DisableFFmpeg" flag:"disable-ffmpeg"` DisableExifTool bool `yaml:"DisableExifTool" json:"DisableExifTool" flag:"disable-exiftool"` DisableSips bool `yaml:"DisableSips" json:"DisableSips" flag:"disable-sips"` DisableDarktable bool `yaml:"DisableDarktable" json:"DisableDarktable" flag:"disable-darktable"` DisableRawTherapee bool `yaml:"DisableRawTherapee" json:"DisableRawTherapee" flag:"disable-rawtherapee"` DisableImageMagick bool `yaml:"DisableImageMagick" json:"DisableImageMagick" flag:"disable-imagemagick"` DisableHeifConvert bool `yaml:"DisableHeifConvert" json:"DisableHeifConvert" flag:"disable-heifconvert"` DisableVectors bool `yaml:"DisableVectors" json:"DisableVectors" flag:"disable-vectors"` DisableJpegXL bool `yaml:"DisableJpegXL" json:"DisableJpegXL" flag:"disable-jpegxl"` DisableRaw bool `yaml:"DisableRaw" json:"DisableRaw" flag:"disable-raw"` RawPresets bool `yaml:"RawPresets" json:"RawPresets" flag:"raw-presets"` ExifBruteForce bool `yaml:"ExifBruteForce" json:"ExifBruteForce" flag:"exif-bruteforce"` DetectNSFW bool `yaml:"DetectNSFW" json:"DetectNSFW" flag:"detect-nsfw"` UploadNSFW bool `yaml:"UploadNSFW" json:"-" flag:"upload-nsfw"` DefaultTheme string `yaml:"DefaultTheme" json:"DefaultTheme" flag:"default-theme"` DefaultLocale string `yaml:"DefaultLocale" json:"DefaultLocale" flag:"default-locale"` AppName string `yaml:"AppName" json:"AppName" flag:"app-name"` AppMode string `yaml:"AppMode" json:"AppMode" flag:"app-mode"` AppIcon string `yaml:"AppIcon" json:"AppIcon" flag:"app-icon"` AppColor string `yaml:"AppColor" json:"AppColor" flag:"app-color"` LegalInfo string `yaml:"LegalInfo" json:"LegalInfo" flag:"legal-info"` LegalUrl string `yaml:"LegalUrl" json:"LegalUrl" flag:"legal-url"` WallpaperUri string `yaml:"WallpaperUri" json:"WallpaperUri" flag:"wallpaper-uri"` SiteUrl string `yaml:"SiteUrl" json:"SiteUrl" flag:"site-url"` SiteAuthor string `yaml:"SiteAuthor" json:"SiteAuthor" flag:"site-author"` SiteTitle string `yaml:"SiteTitle" json:"SiteTitle" flag:"site-title"` SiteCaption string `yaml:"SiteCaption" json:"SiteCaption" flag:"site-caption"` SiteDescription string `yaml:"SiteDescription" json:"SiteDescription" flag:"site-description"` SitePreview string `yaml:"SitePreview" json:"SitePreview" flag:"site-preview"` CdnUrl string `yaml:"CdnUrl" json:"CdnUrl" flag:"cdn-url"` CdnVideo bool `yaml:"CdnVideo" json:"CdnVideo" flag:"cdn-video"` CORSOrigin string `yaml:"CORSOrigin" json:"-" flag:"cors-origin"` CORSHeaders string `yaml:"CORSHeaders" json:"-" flag:"cors-headers"` CORSMethods string `yaml:"CORSMethods" json:"-" flag:"cors-methods"` HttpsProxy string `yaml:"HttpsProxy" json:"HttpsProxy" flag:"https-proxy"` HttpsProxyInsecure bool `yaml:"HttpsProxyInsecure" json:"HttpsProxyInsecure" flag:"https-proxy-insecure"` TrustedProxies []string `yaml:"TrustedProxies" json:"-" flag:"trusted-proxy"` ProxyProtoHeaders []string `yaml:"ProxyProtoHeaders" json:"-" flag:"proxy-proto-header"` ProxyProtoHttps []string `yaml:"ProxyProtoHttps" json:"-" flag:"proxy-proto-https"` DisableTLS bool `yaml:"DisableTLS" json:"DisableTLS" flag:"disable-tls"` DefaultTLS bool `yaml:"DefaultTLS" json:"DefaultTLS" flag:"default-tls"` TLSEmail string `yaml:"TLSEmail" json:"TLSEmail" flag:"tls-email"` TLSCert string `yaml:"TLSCert" json:"TLSCert" flag:"tls-cert"` TLSKey string `yaml:"TLSKey" json:"TLSKey" flag:"tls-key"` HttpMode string `yaml:"HttpMode" json:"-" flag:"http-mode"` HttpCompression string `yaml:"HttpCompression" json:"-" flag:"http-compression"` HttpCachePublic bool `yaml:"HttpCachePublic" json:"HttpCachePublic" flag:"http-cache-public"` HttpCacheMaxAge int `yaml:"HttpCacheMaxAge" json:"HttpCacheMaxAge" flag:"http-cache-maxage"` HttpVideoMaxAge int `yaml:"HttpVideoMaxAge" json:"HttpVideoMaxAge" flag:"http-video-maxage"` HttpHost string `yaml:"HttpHost" json:"-" flag:"http-host"` HttpPort int `yaml:"HttpPort" json:"-" flag:"http-port"` HttpSocket string `yaml:"-" json:"-" flag:"-"` DatabaseDriver string `yaml:"DatabaseDriver" json:"-" flag:"database-driver"` DatabaseDsn string `yaml:"DatabaseDsn" json:"-" flag:"database-dsn"` DatabaseName string `yaml:"DatabaseName" json:"-" flag:"database-name"` DatabaseServer string `yaml:"DatabaseServer" json:"-" flag:"database-server"` DatabaseUser string `yaml:"DatabaseUser" json:"-" flag:"database-user"` DatabasePassword string `yaml:"DatabasePassword" json:"-" flag:"database-password"` DatabaseConns int `yaml:"DatabaseConns" json:"-" flag:"database-conns"` DatabaseConnsIdle int `yaml:"DatabaseConnsIdle" json:"-" flag:"database-conns-idle"` SipsBin string `yaml:"SipsBin" json:"-" flag:"sips-bin"` SipsBlacklist string `yaml:"SipsBlacklist" json:"-" flag:"sips-blacklist"` FFmpegBin string `yaml:"FFmpegBin" json:"-" flag:"ffmpeg-bin"` FFmpegEncoder string `yaml:"FFmpegEncoder" json:"FFmpegEncoder" flag:"ffmpeg-encoder"` FFmpegSize int `yaml:"FFmpegSize" json:"FFmpegSize" flag:"ffmpeg-size"` FFmpegBitrate int `yaml:"FFmpegBitrate" json:"FFmpegBitrate" flag:"ffmpeg-bitrate"` FFmpegMapVideo string `yaml:"FFmpegMapVideo" json:"FFmpegMapVideo" flag:"ffmpeg-map-video"` FFmpegMapAudio string `yaml:"FFmpegMapAudio" json:"FFmpegMapAudio" flag:"ffmpeg-map-audio"` ExifToolBin string `yaml:"ExifToolBin" json:"-" flag:"exiftool-bin"` DarktableBin string `yaml:"DarktableBin" json:"-" flag:"darktable-bin"` DarktableCachePath string `yaml:"DarktableCachePath" json:"-" flag:"darktable-cache-path"` DarktableConfigPath string `yaml:"DarktableConfigPath" json:"-" flag:"darktable-config-path"` DarktableBlacklist string `yaml:"DarktableBlacklist" json:"-" flag:"darktable-blacklist"` RawTherapeeBin string `yaml:"RawTherapeeBin" json:"-" flag:"rawtherapee-bin"` RawTherapeeBlacklist string `yaml:"RawTherapeeBlacklist" json:"-" flag:"rawtherapee-blacklist"` ImageMagickBin string `yaml:"ImageMagickBin" json:"-" flag:"imagemagick-bin"` ImageMagickBlacklist string `yaml:"ImageMagickBlacklist" json:"-" flag:"imagemagick-blacklist"` HeifConvertBin string `yaml:"HeifConvertBin" json:"-" flag:"heifconvert-bin"` RsvgConvertBin string `yaml:"RsvgConvertBin" json:"-" flag:"rsvgconvert-bin"` DownloadToken string `yaml:"DownloadToken" json:"-" flag:"download-token"` PreviewToken string `yaml:"PreviewToken" json:"-" flag:"preview-token"` ThumbColor string `yaml:"ThumbColor" json:"ThumbColor" flag:"thumb-color"` ThumbFilter string `yaml:"ThumbFilter" json:"ThumbFilter" flag:"thumb-filter"` ThumbSize int `yaml:"ThumbSize" json:"ThumbSize" flag:"thumb-size"` ThumbSizeUncached int `yaml:"ThumbSizeUncached" json:"ThumbSizeUncached" flag:"thumb-size-uncached"` ThumbUncached bool `yaml:"ThumbUncached" json:"ThumbUncached" flag:"thumb-uncached"` JpegQuality string `yaml:"JpegQuality" json:"JpegQuality" flag:"jpeg-quality"` JpegSize int `yaml:"JpegSize" json:"JpegSize" flag:"jpeg-size"` PngSize int `yaml:"PngSize" json:"PngSize" flag:"png-size"` FaceSize int `yaml:"-" json:"-" flag:"face-size"` FaceScore float64 `yaml:"-" json:"-" flag:"face-score"` FaceOverlap int `yaml:"-" json:"-" flag:"face-overlap"` FaceClusterSize int `yaml:"-" json:"-" flag:"face-cluster-size"` FaceClusterScore int `yaml:"-" json:"-" flag:"face-cluster-score"` FaceClusterCore int `yaml:"-" json:"-" flag:"face-cluster-core"` FaceClusterDist float64 `yaml:"-" json:"-" flag:"face-cluster-dist"` FaceMatchDist float64 `yaml:"-" json:"-" flag:"face-match-dist"` PIDFilename string `yaml:"PIDFilename" json:"-" flag:"pid-filename"` LogFilename string `yaml:"LogFilename" json:"-" flag:"log-filename"` DetachServer bool `yaml:"DetachServer" json:"-" flag:"detach-server"` }
Options hold the global configuration values without further validation or processing. Application code should retrieve option values via getter functions since they provide validation and return defaults if a value is empty.
func NewOptions ¶
NewOptions creates a new configuration entity by using two methods:
1. Load: This will initialize options from a yaml config file.
- ApplyCliContext: Which comes after Load and overrides any previous options giving an option two override file configs through the CLI.
func NewTestOptions ¶
NewTestOptions returns valid config options for tests.
func NewTestOptionsError ¶
func NewTestOptionsError() *Options
NewTestOptionsError returns invalid config options for tests.
func (*Options) ApplyCliContext ¶
ApplyCliContext uses options from the CLI to setup configuration overrides for the entity.
type ThumbSize ¶
type ThumbSize struct { Size string `json:"size"` Usage string `json:"usage"` Width int `json:"w"` Height int `json:"h"` }
ThumbSize represents thumbnail info for use in client apps.
type ThumbSizes ¶
type ThumbSizes []ThumbSize
ThumbSizes represents a list of thumbnail types.
var Thumbs ThumbSizes
Thumbs is a list of thumbnails for use in client apps.
Source Files ¶
- cli_context.go
- cli_flag.go
- cli_flags.go
- cli_flags_report.go
- client_assets.go
- client_config.go
- client_ext.go
- config.go
- config_app.go
- config_auth.go
- config_cache.go
- config_const.go
- config_convert.go
- config_customize.go
- config_db.go
- config_faces.go
- config_features.go
- config_ffmpeg.go
- config_filepaths.go
- config_metadata.go
- config_proxy.go
- config_raw.go
- config_resample.go
- config_server.go
- config_tensorflow.go
- config_tls.go
- dsn.go
- env.go
- err.go
- error.go
- extensions.go
- flags.go
- map.go
- messages.go
- options.go
- options_report.go
- report.go
- settings.go
- test.go
- thumbnails.go
- var.go