2022-04-12 19:14:21 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
"unicode/utf8"
|
|
|
|
)
|
|
|
|
|
2022-04-14 10:49:56 +02:00
|
|
|
// Report returns global config values as a table for reporting.
|
|
|
|
func (c *Config) Report() (rows [][]string, cols []string) {
|
2022-10-12 14:57:33 +02:00
|
|
|
cols = []string{"Name", "Value"}
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2022-09-15 07:29:09 +02:00
|
|
|
var dbKey string
|
|
|
|
|
|
|
|
if c.DatabaseDriver() == SQLite3 {
|
|
|
|
dbKey = "database-dsn"
|
|
|
|
} else {
|
|
|
|
dbKey = "database-name"
|
|
|
|
}
|
|
|
|
|
2022-04-12 19:14:21 +02:00
|
|
|
rows = [][]string{
|
2022-04-22 17:38:40 +02:00
|
|
|
// Authentication.
|
2022-07-07 19:12:28 +02:00
|
|
|
{"auth-mode", fmt.Sprintf("%s", c.AuthMode())},
|
2022-09-02 21:30:50 +02:00
|
|
|
{"admin-user", c.AdminUser()},
|
2022-04-12 20:00:06 +02:00
|
|
|
{"admin-password", strings.Repeat("*", utf8.RuneCountInString(c.AdminPassword()))},
|
2022-04-22 17:38:40 +02:00
|
|
|
{"public", fmt.Sprintf("%t", c.Public())},
|
2022-10-25 06:19:56 +02:00
|
|
|
{"session-maxage", fmt.Sprintf("%d", c.SessionMaxAge())},
|
|
|
|
{"session-timeout", fmt.Sprintf("%d", c.SessionTimeout())},
|
2022-11-22 22:14:34 +01:00
|
|
|
{"login-uri", c.LoginUri()},
|
|
|
|
{"register-uri", c.RegisterUri()},
|
|
|
|
{"password-length", fmt.Sprintf("%d", c.PasswordLength())},
|
|
|
|
{"password-reset-uri", c.PasswordResetUri()},
|
2022-04-22 17:38:40 +02:00
|
|
|
|
|
|
|
// Logging.
|
2022-04-12 19:14:21 +02:00
|
|
|
{"log-level", c.LogLevel().String()},
|
|
|
|
{"debug", fmt.Sprintf("%t", c.Debug())},
|
|
|
|
{"trace", fmt.Sprintf("%t", c.Trace())},
|
|
|
|
|
|
|
|
// Config.
|
|
|
|
{"config-path", c.ConfigPath()},
|
2022-10-19 05:09:09 +02:00
|
|
|
{"certificates-path", c.CertificatesPath()},
|
2022-04-13 22:43:49 +02:00
|
|
|
{"options-yaml", c.OptionsYaml()},
|
|
|
|
{"defaults-yaml", c.DefaultsYaml()},
|
2023-01-30 14:56:31 +01:00
|
|
|
}
|
|
|
|
|
2023-02-02 12:09:46 +01:00
|
|
|
// Settings.
|
2023-01-30 14:56:31 +01:00
|
|
|
if settingsDefaults := c.SettingsYamlDefaults(""); settingsDefaults != "" && settingsDefaults != c.SettingsYaml() {
|
|
|
|
rows = append(rows, []string{"settings-yaml", fmt.Sprintf("%s (defaults)", settingsDefaults)})
|
|
|
|
}
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2023-01-30 14:56:31 +01:00
|
|
|
rows = append(rows, [][]string{
|
2023-02-02 12:09:46 +01:00
|
|
|
{"settings-yaml", c.SettingsYaml()},
|
|
|
|
|
2022-04-12 19:14:21 +02:00
|
|
|
// Originals.
|
|
|
|
{"originals-path", c.OriginalsPath()},
|
|
|
|
{"originals-limit", fmt.Sprintf("%d", c.OriginalsLimit())},
|
|
|
|
{"resolution-limit", fmt.Sprintf("%d", c.ResolutionLimit())},
|
2023-03-14 23:17:12 +01:00
|
|
|
{"users-path", c.UsersPath()},
|
|
|
|
{"users-originals-path", c.UsersOriginalsPath()},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2023-03-14 21:47:14 +01:00
|
|
|
// Storage.
|
2022-04-12 19:14:21 +02:00
|
|
|
{"storage-path", c.StoragePath()},
|
2023-03-14 23:17:12 +01:00
|
|
|
{"users-storage-path", c.UsersStoragePath()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"sidecar-path", c.SidecarPath()},
|
|
|
|
{"albums-path", c.AlbumsPath()},
|
|
|
|
{"backup-path", c.BackupPath()},
|
2022-04-18 13:55:17 +02:00
|
|
|
{"cache-path", c.CachePath()},
|
|
|
|
{"cmd-cache-path", c.CmdCachePath()},
|
2023-02-21 13:31:30 +01:00
|
|
|
{"media-cache-path", c.MediaCachePath()},
|
2022-04-18 13:55:17 +02:00
|
|
|
{"thumb-cache-path", c.ThumbCachePath()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"import-path", c.ImportPath()},
|
2022-09-30 00:42:19 +02:00
|
|
|
{"import-dest", c.ImportDest()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"assets-path", c.AssetsPath()},
|
|
|
|
{"static-path", c.StaticPath()},
|
|
|
|
{"build-path", c.BuildPath()},
|
|
|
|
{"img-path", c.ImgPath()},
|
|
|
|
{"templates-path", c.TemplatesPath()},
|
|
|
|
{"temp-path", c.TempPath()},
|
|
|
|
|
|
|
|
// Workers.
|
|
|
|
{"workers", fmt.Sprintf("%d", c.Workers())},
|
|
|
|
{"wakeup-interval", c.WakeupInterval().String()},
|
|
|
|
{"auto-index", fmt.Sprintf("%d", c.AutoIndex()/time.Second)},
|
|
|
|
{"auto-import", fmt.Sprintf("%d", c.AutoImport()/time.Second)},
|
|
|
|
|
|
|
|
// Feature Flags.
|
2022-04-22 17:38:40 +02:00
|
|
|
{"read-only", fmt.Sprintf("%t", c.ReadOnly())},
|
|
|
|
{"experimental", fmt.Sprintf("%t", c.Experimental())},
|
2022-06-28 16:14:01 +02:00
|
|
|
{"disable-webdav", fmt.Sprintf("%t", c.DisableWebDAV())},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"disable-settings", fmt.Sprintf("%t", c.DisableSettings())},
|
|
|
|
{"disable-places", fmt.Sprintf("%t", c.DisablePlaces())},
|
2022-06-28 16:14:01 +02:00
|
|
|
{"disable-backups", fmt.Sprintf("%t", c.DisableBackups())},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"disable-tensorflow", fmt.Sprintf("%t", c.DisableTensorFlow())},
|
|
|
|
{"disable-faces", fmt.Sprintf("%t", c.DisableFaces())},
|
|
|
|
{"disable-classification", fmt.Sprintf("%t", c.DisableClassification())},
|
2023-02-11 20:18:04 +01:00
|
|
|
{"disable-sips", fmt.Sprintf("%t", c.DisableSips())},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"disable-ffmpeg", fmt.Sprintf("%t", c.DisableFFmpeg())},
|
|
|
|
{"disable-exiftool", fmt.Sprintf("%t", c.DisableExifTool())},
|
|
|
|
{"disable-darktable", fmt.Sprintf("%t", c.DisableDarktable())},
|
2023-02-11 20:18:04 +01:00
|
|
|
{"disable-rawtherapee", fmt.Sprintf("%t", c.DisableRawTherapee())},
|
|
|
|
{"disable-imagemagick", fmt.Sprintf("%t", c.DisableImageMagick())},
|
|
|
|
{"disable-heifconvert", fmt.Sprintf("%t", c.DisableHeifConvert())},
|
|
|
|
{"disable-rsvgconvert", fmt.Sprintf("%t", c.DisableRsvgConvert())},
|
2023-02-19 16:42:19 +01:00
|
|
|
{"disable-vectors", fmt.Sprintf("%t", c.DisableVectors())},
|
2023-02-14 14:43:49 +01:00
|
|
|
{"disable-jpegxl", fmt.Sprintf("%t", c.DisableJpegXL())},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"disable-raw", fmt.Sprintf("%t", c.DisableRaw())},
|
|
|
|
|
|
|
|
// Format Flags.
|
|
|
|
{"raw-presets", fmt.Sprintf("%t", c.RawPresets())},
|
|
|
|
{"exif-bruteforce", fmt.Sprintf("%t", c.ExifBruteForce())},
|
|
|
|
|
|
|
|
// TensorFlow.
|
|
|
|
{"detect-nsfw", fmt.Sprintf("%t", c.DetectNSFW())},
|
|
|
|
{"upload-nsfw", fmt.Sprintf("%t", c.UploadNSFW())},
|
|
|
|
{"tensorflow-version", c.TensorFlowVersion()},
|
|
|
|
{"tensorflow-model-path", c.TensorFlowModelPath()},
|
|
|
|
|
2022-04-22 17:38:40 +02:00
|
|
|
// Customization.
|
2022-04-12 19:14:21 +02:00
|
|
|
{"default-locale", c.DefaultLocale()},
|
2022-04-22 17:38:40 +02:00
|
|
|
{"default-theme", c.DefaultTheme()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"app-name", c.AppName()},
|
|
|
|
{"app-mode", c.AppMode()},
|
2023-02-10 15:53:01 +01:00
|
|
|
{"app-icon", c.AppIcon()},
|
|
|
|
{"app-color", c.AppColor()},
|
2023-01-19 20:46:27 +01:00
|
|
|
{"legal-info", c.LegalInfo()},
|
|
|
|
{"legal-url", c.LegalUrl()},
|
2022-04-22 17:38:40 +02:00
|
|
|
{"wallpaper-uri", c.WallpaperUri()},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
|
|
|
// Site Infos.
|
|
|
|
{"cdn-url", c.CdnUrl("/")},
|
2023-04-14 11:47:27 +02:00
|
|
|
{"cdn-video", fmt.Sprintf("%t", c.CdnVideo())},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"site-url", c.SiteUrl()},
|
2022-10-19 05:09:09 +02:00
|
|
|
{"site-https", fmt.Sprintf("%t", c.SiteHttps())},
|
|
|
|
{"site-domain", c.SiteDomain()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"site-author", c.SiteAuthor()},
|
|
|
|
{"site-title", c.SiteTitle()},
|
|
|
|
{"site-caption", c.SiteCaption()},
|
|
|
|
{"site-description", c.SiteDescription()},
|
|
|
|
{"site-preview", c.SitePreview()},
|
|
|
|
|
|
|
|
// URIs.
|
|
|
|
{"base-uri", c.BaseUri("/")},
|
2023-04-14 11:47:27 +02:00
|
|
|
{"api-uri", c.ApiUri()},
|
|
|
|
{"static-uri", c.StaticUri()},
|
|
|
|
{"content-uri", c.ContentUri()},
|
|
|
|
{"video-uri", c.VideoUri()},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2023-01-20 00:37:51 +01:00
|
|
|
// Proxy Servers.
|
2023-01-19 20:46:27 +01:00
|
|
|
{"https-proxy", c.HttpsProxy()},
|
|
|
|
{"https-proxy-insecure", fmt.Sprintf("%t", c.HttpsProxyInsecure())},
|
2022-10-12 14:57:33 +02:00
|
|
|
{"trusted-proxy", c.TrustedProxy()},
|
2022-11-02 18:55:30 +01:00
|
|
|
{"proxy-proto-header", strings.Join(c.ProxyProtoHeader(), ", ")},
|
|
|
|
{"proxy-proto-https", strings.Join(c.ProxyProtoHttps(), ", ")},
|
2022-10-11 22:44:11 +02:00
|
|
|
|
2022-04-12 19:14:21 +02:00
|
|
|
// Web Server.
|
2022-10-25 06:19:56 +02:00
|
|
|
{"disable-tls", fmt.Sprintf("%t", c.DisableTLS())},
|
2022-10-19 05:09:09 +02:00
|
|
|
{"tls-email", c.TLSEmail()},
|
|
|
|
{"tls-cert", c.TLSCert()},
|
|
|
|
{"tls-key", c.TLSKey()},
|
2023-01-20 00:37:51 +01:00
|
|
|
{"http-mode", c.HttpMode()},
|
|
|
|
{"http-compression", c.HttpCompression()},
|
2023-03-20 20:37:07 +01:00
|
|
|
{"http-cache-maxage", fmt.Sprintf("%d", c.HttpCacheMaxAge())},
|
2023-03-20 11:40:46 +01:00
|
|
|
{"http-cache-public", fmt.Sprintf("%t", c.HttpCachePublic())},
|
2023-01-20 00:37:51 +01:00
|
|
|
{"http-host", c.HttpHost()},
|
|
|
|
{"http-port", fmt.Sprintf("%d", c.HttpPort())},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
|
|
|
// Database.
|
|
|
|
{"database-driver", c.DatabaseDriver()},
|
2022-09-15 07:29:09 +02:00
|
|
|
{dbKey, c.DatabaseName()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"database-server", c.DatabaseServer()},
|
|
|
|
{"database-host", c.DatabaseHost()},
|
|
|
|
{"database-port", c.DatabasePortString()},
|
|
|
|
{"database-user", c.DatabaseUser()},
|
|
|
|
{"database-password", strings.Repeat("*", utf8.RuneCountInString(c.DatabasePassword()))},
|
|
|
|
{"database-conns", fmt.Sprintf("%d", c.DatabaseConns())},
|
|
|
|
{"database-conns-idle", fmt.Sprintf("%d", c.DatabaseConnsIdle())},
|
2023-06-02 17:07:10 +02:00
|
|
|
{"mariadb-bin", c.MariadbBin()},
|
|
|
|
{"mariadb-dump-bin", c.MariadbDumpBin()},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2023-02-11 20:18:04 +01:00
|
|
|
// File Converters.
|
2022-04-12 19:14:21 +02:00
|
|
|
{"sips-bin", c.SipsBin()},
|
2022-09-15 00:43:08 +02:00
|
|
|
{"sips-blacklist", c.SipsBlacklist()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"ffmpeg-bin", c.FFmpegBin()},
|
|
|
|
{"ffmpeg-encoder", c.FFmpegEncoder().String()},
|
|
|
|
{"ffmpeg-bitrate", fmt.Sprintf("%d", c.FFmpegBitrate())},
|
2023-06-28 15:22:52 +02:00
|
|
|
{"ffmpeg-resolution", fmt.Sprintf("%d", c.FFmpegResolution())},
|
2023-03-14 18:00:55 +01:00
|
|
|
{"ffmpeg-map-video", c.FFmpegMapVideo()},
|
|
|
|
{"ffmpeg-map-audio", c.FFmpegMapAudio()},
|
2022-04-12 19:14:21 +02:00
|
|
|
{"exiftool-bin", c.ExifToolBin()},
|
2023-02-11 20:18:04 +01:00
|
|
|
{"darktable-bin", c.DarktableBin()},
|
|
|
|
{"darktable-cache-path", c.DarktableCachePath()},
|
|
|
|
{"darktable-config-path", c.DarktableConfigPath()},
|
|
|
|
{"darktable-blacklist", c.DarktableBlacklist()},
|
|
|
|
{"rawtherapee-bin", c.RawTherapeeBin()},
|
|
|
|
{"rawtherapee-blacklist", c.RawTherapeeBlacklist()},
|
|
|
|
{"imagemagick-bin", c.ImageMagickBin()},
|
|
|
|
{"imagemagick-blacklist", c.ImageMagickBlacklist()},
|
|
|
|
{"heifconvert-bin", c.HeifConvertBin()},
|
|
|
|
{"rsvgconvert-bin", c.RsvgConvertBin()},
|
2023-02-14 14:43:49 +01:00
|
|
|
{"jpegxldecoder-bin", c.JpegXLDecoderBin()},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
|
|
|
// Thumbnails.
|
|
|
|
{"download-token", c.DownloadToken()},
|
|
|
|
{"preview-token", c.PreviewToken()},
|
|
|
|
{"thumb-color", c.ThumbColor()},
|
|
|
|
{"thumb-filter", string(c.ThumbFilter())},
|
|
|
|
{"thumb-size", fmt.Sprintf("%d", c.ThumbSizePrecached())},
|
|
|
|
{"thumb-size-uncached", fmt.Sprintf("%d", c.ThumbSizeUncached())},
|
|
|
|
{"thumb-uncached", fmt.Sprintf("%t", c.ThumbUncached())},
|
|
|
|
{"jpeg-quality", fmt.Sprintf("%d", c.JpegQuality())},
|
|
|
|
{"jpeg-size", fmt.Sprintf("%d", c.JpegSize())},
|
2023-02-11 20:18:04 +01:00
|
|
|
{"png-size", fmt.Sprintf("%d", c.PngSize())},
|
2022-04-12 19:14:21 +02:00
|
|
|
|
|
|
|
// Facial Recognition.
|
|
|
|
{"face-size", fmt.Sprintf("%d", c.FaceSize())},
|
|
|
|
{"face-score", fmt.Sprintf("%f", c.FaceScore())},
|
|
|
|
{"face-overlap", fmt.Sprintf("%d", c.FaceOverlap())},
|
|
|
|
{"face-cluster-size", fmt.Sprintf("%d", c.FaceClusterSize())},
|
|
|
|
{"face-cluster-score", fmt.Sprintf("%d", c.FaceClusterScore())},
|
|
|
|
{"face-cluster-core", fmt.Sprintf("%d", c.FaceClusterCore())},
|
|
|
|
{"face-cluster-dist", fmt.Sprintf("%f", c.FaceClusterDist())},
|
|
|
|
{"face-match-dist", fmt.Sprintf("%f", c.FaceMatchDist())},
|
|
|
|
|
|
|
|
// Daemon Mode.
|
|
|
|
{"pid-filename", c.PIDFilename()},
|
|
|
|
{"log-filename", c.LogFilename()},
|
2023-01-30 14:56:31 +01:00
|
|
|
}...)
|
2022-04-12 19:14:21 +02:00
|
|
|
|
2022-09-02 21:30:50 +02:00
|
|
|
if v := c.CustomAssetsPath(); v != "" {
|
|
|
|
rows = append(rows, []string{"custom-assets-path", v})
|
|
|
|
}
|
|
|
|
|
|
|
|
if v := c.CustomStaticUri(); v != "" {
|
|
|
|
rows = append(rows, []string{"custom-static-uri", v})
|
2022-07-05 23:13:34 +02:00
|
|
|
}
|
|
|
|
|
2022-04-12 19:14:21 +02:00
|
|
|
return rows, cols
|
|
|
|
}
|