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
|
|
|
|
2019-05-06 23:18:10 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
2018-09-24 09:53:16 +02:00
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
2020-05-31 02:09:52 +02:00
|
|
|
// Feature flags.
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "debug", conf.Debug())
|
|
|
|
fmt.Printf("%-25s %t\n", "public", conf.Public())
|
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
|
|
|
|
2020-12-17 18:24:55 +01:00
|
|
|
// Config path and main file.
|
|
|
|
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())
|
|
|
|
|
2020-12-18 09:11:42 +01:00
|
|
|
// Main directories.
|
|
|
|
fmt.Printf("%-25s %s\n", "originals-path", conf.OriginalsPath())
|
|
|
|
fmt.Printf("%-25s %d\n", "originals-limit", conf.OriginalsLimit())
|
|
|
|
fmt.Printf("%-25s %s\n", "import-path", conf.ImportPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "storage-path", conf.StoragePath())
|
|
|
|
fmt.Printf("%-25s %s\n", "sidecar-path", conf.SidecarPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "albums-path", conf.AlbumsPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "cache-path", conf.CachePath())
|
|
|
|
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())
|
|
|
|
|
|
|
|
// Asset path and file names.
|
|
|
|
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-01-09 12:18:59 +01:00
|
|
|
// Background 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
|
|
|
|
|
|
|
// Disable features.
|
|
|
|
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())
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-exiftool", conf.DisableExifTool())
|
2021-04-30 14:24:01 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-tensorflow", conf.DisableTensorFlow())
|
|
|
|
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())
|
2020-12-18 09:11:42 +01:00
|
|
|
|
|
|
|
// Everything related to TensorFlow.
|
|
|
|
fmt.Printf("%-25s %s\n", "tensorflow-version", conf.TensorFlowVersion())
|
|
|
|
fmt.Printf("%-25s %s\n", "tensorflow-model-path", conf.TensorFlowModelPath())
|
|
|
|
fmt.Printf("%-25s %t\n", "detect-nsfw", conf.DetectNSFW())
|
|
|
|
fmt.Printf("%-25s %t\n", "upload-nsfw", conf.UploadNSFW())
|
2020-12-17 18:24:55 +01:00
|
|
|
|
2020-05-31 02:09:52 +02:00
|
|
|
// Site information.
|
|
|
|
fmt.Printf("%-25s %s\n", "site-url", conf.SiteUrl())
|
2020-06-26 14:26:36 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "site-preview", conf.SitePreview())
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "site-title", conf.SiteTitle())
|
|
|
|
fmt.Printf("%-25s %s\n", "site-caption", conf.SiteCaption())
|
|
|
|
fmt.Printf("%-25s %s\n", "site-description", conf.SiteDescription())
|
|
|
|
fmt.Printf("%-25s %s\n", "site-author", conf.SiteAuthor())
|
|
|
|
|
2020-12-18 09:11:42 +01:00
|
|
|
// Logging.
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "log-level", conf.LogLevel())
|
|
|
|
fmt.Printf("%-25s %s\n", "log-filename", conf.LogFilename())
|
|
|
|
fmt.Printf("%-25s %s\n", "pid-filename", conf.PIDFilename())
|
2020-05-31 02:09:52 +02:00
|
|
|
|
|
|
|
// HTTP server configuration.
|
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())
|
|
|
|
|
|
|
|
// Passwords.
|
|
|
|
fmt.Printf("%-25s %s\n", "admin-password", strings.Repeat("*", utf8.RuneCountInString(conf.AdminPassword())))
|
2020-05-31 02:09:52 +02:00
|
|
|
|
|
|
|
// Database configuration.
|
|
|
|
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
|
|
|
|
|
|
|
// External binaries and sidecar configuration.
|
2020-08-12 13:16:25 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "rawtherapee-bin", conf.RawtherapeeBin())
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "darktable-bin", conf.DarktableBin())
|
2020-07-21 12:18:53 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "darktable-presets", conf.DarktablePresets())
|
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
|
|
|
|
2020-07-13 17:25:27 +02:00
|
|
|
// Thumbs, resampling and download security token.
|
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())
|
|
|
|
fmt.Printf("%-25s %d\n", "thumb-size", conf.ThumbSize())
|
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
|
|
|
|
2018-09-24 09:53:16 +02:00
|
|
|
return nil
|
|
|
|
}
|