2018-09-24 09:53:16 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-12-18 09:11:42 +01:00
|
|
|
"strings"
|
2020-04-06 22:09:45 +02:00
|
|
|
"time"
|
2020-12-18 09:11:42 +01:00
|
|
|
"unicode/utf8"
|
2018-10-31 07:14:33 +01:00
|
|
|
|
2018-09-24 09:53:16 +02:00
|
|
|
"github.com/urfave/cli"
|
2021-09-22 19:33:41 +02:00
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
2018-09-24 09:53:16 +02:00
|
|
|
)
|
|
|
|
|
2021-01-24 17:46:18 +01:00
|
|
|
// ConfigCommand registers the display config cli command.
|
2018-09-24 09:53:16 +02:00
|
|
|
var ConfigCommand = cli.Command{
|
|
|
|
Name: "config",
|
|
|
|
Usage: "Displays global configuration values",
|
|
|
|
Action: configAction,
|
|
|
|
}
|
|
|
|
|
2021-01-24 17:46:18 +01:00
|
|
|
// configAction lists configuration options and their values.
|
2018-11-17 06:21:39 +01:00
|
|
|
func configAction(ctx *cli.Context) error {
|
2019-05-06 23:18:10 +02:00
|
|
|
conf := config.NewConfig(ctx)
|
2018-09-24 09:53:16 +02:00
|
|
|
|
2020-05-30 14:52:47 +02:00
|
|
|
dbDriver := conf.DatabaseDriver()
|
|
|
|
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s VALUE\n", "NAME")
|
2020-05-05 17:04:13 +02:00
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Flags.
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "debug", conf.Debug())
|
2021-10-05 22:33:29 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "log-level", conf.LogLevel())
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "public", conf.Public())
|
2021-10-05 22:33:29 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "admin-password", strings.Repeat("*", utf8.RuneCountInString(conf.AdminPassword())))
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "read-only", conf.ReadOnly())
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "experimental", conf.Experimental())
|
2020-05-05 17:04:13 +02:00
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Config.
|
2020-12-17 18:24:55 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "config-file", conf.ConfigFile())
|
2020-12-21 15:00:18 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "config-path", conf.ConfigPath())
|
2020-12-17 18:24:55 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "settings-file", conf.SettingsFile())
|
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Paths.
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "originals-path", conf.OriginalsPath())
|
|
|
|
fmt.Printf("%-25s %d\n", "originals-limit", conf.OriginalsLimit())
|
|
|
|
fmt.Printf("%-25s %s\n", "storage-path", conf.StoragePath())
|
2022-01-11 14:34:30 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "import-path", conf.ImportPath())
|
2021-10-11 23:25:49 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "cache-path", conf.CachePath())
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "sidecar-path", conf.SidecarPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "albums-path", conf.AlbumsPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "temp-path", conf.TempPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "backup-path", conf.BackupPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "assets-path", conf.AssetsPath())
|
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Assets.
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "static-path", conf.StaticPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "build-path", conf.BuildPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "img-path", conf.ImgPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "templates-path", conf.TemplatesPath())
|
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Workers.
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %d\n", "workers", conf.Workers())
|
|
|
|
fmt.Printf("%-25s %d\n", "wakeup-interval", conf.WakeupInterval()/time.Second)
|
2021-01-02 18:56:15 +01:00
|
|
|
fmt.Printf("%-25s %d\n", "auto-index", conf.AutoIndex()/time.Second)
|
|
|
|
fmt.Printf("%-25s %d\n", "auto-import", conf.AutoImport()/time.Second)
|
2020-12-18 09:11:42 +01:00
|
|
|
|
2022-03-28 15:57:29 +02:00
|
|
|
// Feature Flags.
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-backups", conf.DisableBackups())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-settings", conf.DisableSettings())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-places", conf.DisablePlaces())
|
2021-04-30 14:24:01 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-tensorflow", conf.DisableTensorFlow())
|
2021-09-24 01:53:42 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-faces", conf.DisableFaces())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-classification", conf.DisableClassification())
|
2021-04-30 14:24:01 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-darktable", conf.DisableDarktable())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-rawtherapee", conf.DisableRawtherapee())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-sips", conf.DisableSips())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-heifconvert", conf.DisableHeifConvert())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-ffmpeg", conf.DisableFFmpeg())
|
2022-03-28 15:57:29 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-exiftool", conf.DisableExifTool())
|
|
|
|
|
|
|
|
// Format Flags.
|
|
|
|
fmt.Printf("%-25s %t\n", "exif-bruteforce", conf.ExifBruteForce())
|
|
|
|
fmt.Printf("%-25s %t\n", "raw-presets", conf.RawPresets())
|
2020-12-18 09:11:42 +01:00
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// TensorFlow.
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %t\n", "detect-nsfw", conf.DetectNSFW())
|
|
|
|
fmt.Printf("%-25s %t\n", "upload-nsfw", conf.UploadNSFW())
|
2022-03-28 15:57:29 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "tensorflow-version", conf.TensorFlowVersion())
|
|
|
|
fmt.Printf("%-25s %s\n", "tensorflow-model-path", conf.TensorFlowModelPath())
|
2020-12-17 18:24:55 +01:00
|
|
|
|
2021-12-12 22:09:22 +01:00
|
|
|
// UI Defaults.
|
|
|
|
fmt.Printf("%-25s %s\n", "default-locale", conf.DefaultLocale())
|
|
|
|
|
2021-11-25 17:24:53 +01:00
|
|
|
// Progressive Web App.
|
2021-11-29 14:39:21 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "app-icon", conf.AppIcon())
|
2021-11-25 17:24:53 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "app-name", conf.AppName())
|
|
|
|
fmt.Printf("%-25s %s\n", "app-mode", conf.AppMode())
|
|
|
|
|
2021-12-12 22:09:22 +01:00
|
|
|
// Site Infos.
|
2021-11-25 17:24:53 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "cdn-url", conf.CdnUrl("/"))
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "site-url", conf.SiteUrl())
|
2021-10-05 18:42:39 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "site-author", conf.SiteAuthor())
|
2021-10-05 22:33:29 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "site-title", conf.SiteTitle())
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "site-caption", conf.SiteCaption())
|
|
|
|
fmt.Printf("%-25s %s\n", "site-description", conf.SiteDescription())
|
2021-11-21 16:36:42 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "site-preview", conf.SitePreview())
|
|
|
|
|
2022-02-08 14:41:03 +01:00
|
|
|
// Legal info.
|
|
|
|
fmt.Printf("%-25s %s\n", "imprint", conf.Imprint())
|
|
|
|
fmt.Printf("%-25s %s\n", "imprint-url", conf.ImprintUrl())
|
|
|
|
|
2021-11-25 17:24:53 +01:00
|
|
|
// URIs.
|
2021-07-05 16:41:43 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "content-uri", conf.ContentUri())
|
|
|
|
fmt.Printf("%-25s %s\n", "static-uri", conf.StaticUri())
|
|
|
|
fmt.Printf("%-25s %s\n", "api-uri", conf.ApiUri())
|
|
|
|
fmt.Printf("%-25s %s\n", "base-uri", conf.BaseUri("/"))
|
2020-05-31 02:09:52 +02:00
|
|
|
|
2022-03-28 15:57:29 +02:00
|
|
|
// Web Server.
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "http-host", conf.HttpHost())
|
|
|
|
fmt.Printf("%-25s %d\n", "http-port", conf.HttpPort())
|
|
|
|
fmt.Printf("%-25s %s\n", "http-mode", conf.HttpMode())
|
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Database.
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "database-driver", dbDriver)
|
2020-12-11 12:46:28 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "database-server", conf.DatabaseServer())
|
|
|
|
fmt.Printf("%-25s %s\n", "database-host", conf.DatabaseHost())
|
|
|
|
fmt.Printf("%-25s %s\n", "database-port", conf.DatabasePortString())
|
|
|
|
fmt.Printf("%-25s %s\n", "database-name", conf.DatabaseName())
|
|
|
|
fmt.Printf("%-25s %s\n", "database-user", conf.DatabaseUser())
|
2020-12-18 09:11:42 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "database-password", strings.Repeat("*", utf8.RuneCountInString(conf.DatabasePassword())))
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "database-conns", conf.DatabaseConns())
|
2020-07-13 10:41:45 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "database-conns-idle", conf.DatabaseConnsIdle())
|
2020-05-31 02:09:52 +02:00
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// External Tools.
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "darktable-bin", conf.DarktableBin())
|
2022-03-02 12:20:02 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "darktable-cache-path", conf.DarktableCachePath())
|
|
|
|
fmt.Printf("%-25s %s\n", "darktable-config-path", conf.DarktableConfigPath())
|
2021-09-21 15:33:46 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "darktable-blacklist", conf.DarktableBlacklist())
|
2021-05-01 10:25:34 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "rawtherapee-bin", conf.RawtherapeeBin())
|
2021-09-21 15:33:46 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "rawtherapee-blacklist", conf.RawtherapeeBlacklist())
|
2020-07-13 15:23:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "sips-bin", conf.SipsBin())
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "heifconvert-bin", conf.HeifConvertBin())
|
2020-05-11 18:29:17 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "ffmpeg-bin", conf.FFmpegBin())
|
2021-02-16 11:40:40 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "ffmpeg-encoder", conf.FFmpegEncoder())
|
2021-02-17 18:19:52 +01:00
|
|
|
fmt.Printf("%-25s %d\n", "ffmpeg-bitrate", conf.FFmpegBitrate())
|
2021-02-16 09:02:34 +01:00
|
|
|
fmt.Printf("%-25s %d\n", "ffmpeg-buffers", conf.FFmpegBuffers())
|
2020-05-11 18:29:17 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "exiftool-bin", conf.ExifToolBin())
|
2020-05-05 17:04:13 +02:00
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Thumbnails.
|
2020-05-27 19:38:40 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "download-token", conf.DownloadToken())
|
2020-06-26 16:11:56 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "preview-token", conf.PreviewToken())
|
2020-05-05 17:17:19 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "thumb-filter", conf.ThumbFilter())
|
|
|
|
fmt.Printf("%-25s %t\n", "thumb-uncached", conf.ThumbUncached())
|
2021-09-05 12:32:08 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "thumb-size", conf.ThumbSizePrecached())
|
2020-07-13 15:23:54 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "thumb-size-uncached", conf.ThumbSizeUncached())
|
2020-05-05 17:17:19 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "thumb-path", conf.ThumbPath())
|
2020-07-14 14:41:38 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "jpeg-size", conf.JpegSize())
|
2020-05-19 11:00:17 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "jpeg-quality", conf.JpegQuality())
|
2020-04-12 18:00:31 +02:00
|
|
|
|
2021-11-21 16:36:42 +01:00
|
|
|
// Facial Recognition.
|
2021-09-23 13:47:18 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "face-size", conf.FaceSize())
|
2021-09-23 13:16:05 +02:00
|
|
|
fmt.Printf("%-25s %f\n", "face-score", conf.FaceScore())
|
|
|
|
fmt.Printf("%-25s %d\n", "face-overlap", conf.FaceOverlap())
|
2021-10-05 10:12:48 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "face-cluster-size", conf.FaceClusterSize())
|
|
|
|
fmt.Printf("%-25s %d\n", "face-cluster-score", conf.FaceClusterScore())
|
2021-09-23 13:16:05 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "face-cluster-core", conf.FaceClusterCore())
|
|
|
|
fmt.Printf("%-25s %f\n", "face-cluster-dist", conf.FaceClusterDist())
|
|
|
|
fmt.Printf("%-25s %f\n", "face-match-dist", conf.FaceMatchDist())
|
|
|
|
|
2021-12-02 13:21:55 +01:00
|
|
|
// Daemon Mode.
|
2021-10-05 22:33:29 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "pid-filename", conf.PIDFilename())
|
2021-12-02 13:21:55 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "log-filename", conf.LogFilename())
|
2021-10-05 22:33:29 +02:00
|
|
|
|
2018-09-24 09:53:16 +02:00
|
|
|
return nil
|
|
|
|
}
|