2018-09-24 09:53:16 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-04-06 22:09:45 +02:00
|
|
|
"time"
|
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"
|
|
|
|
)
|
|
|
|
|
2020-02-18 23:42:51 +01:00
|
|
|
// ConfigCommand is used to register 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,
|
|
|
|
}
|
|
|
|
|
2020-02-18 23:42:51 +01:00
|
|
|
// configAction prints current configuration
|
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()
|
|
|
|
dbDsn := conf.DatabaseDsn()
|
|
|
|
|
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-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())
|
|
|
|
|
|
|
|
// Everything related to TensorFlow.
|
|
|
|
fmt.Printf("%-25s %t\n", "tf-off", conf.TensorFlowOff())
|
2020-05-05 17:04:13 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "tf-version", conf.TensorFlowVersion())
|
|
|
|
fmt.Printf("%-25s %s\n", "tf-model-path", conf.TensorFlowModelPath())
|
|
|
|
fmt.Printf("%-25s %t\n", "detect-nsfw", conf.DetectNSFW())
|
|
|
|
fmt.Printf("%-25s %t\n", "upload-nsfw", conf.UploadNSFW())
|
|
|
|
|
2020-05-31 02:09:52 +02:00
|
|
|
// Passwords.
|
2020-05-05 18:26:44 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "admin-password", conf.AdminPassword())
|
|
|
|
|
2020-05-31 02:09:52 +02:00
|
|
|
// Background workers and logging.
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "workers", conf.Workers())
|
|
|
|
fmt.Printf("%-25s %d\n", "wakeup-interval", conf.WakeupInterval()/time.Second)
|
|
|
|
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.
|
|
|
|
fmt.Printf("%-25s %s\n", "http-host", conf.HttpServerHost())
|
|
|
|
fmt.Printf("%-25s %d\n", "http-port", conf.HttpServerPort())
|
|
|
|
fmt.Printf("%-25s %s\n", "http-mode", conf.HttpServerMode())
|
|
|
|
|
|
|
|
// Database configuration.
|
|
|
|
fmt.Printf("%-25s %s\n", "database-driver", dbDriver)
|
|
|
|
fmt.Printf("%-25s %s\n", "database-dsn", dbDsn)
|
|
|
|
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
|
|
|
|
|
|
|
// Main directories.
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "assets-path", conf.AssetsPath())
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "storage-path", conf.StoragePath())
|
2020-12-04 11:02:19 +01:00
|
|
|
fmt.Printf("%-25s %s\n", "backup-path", conf.BackupPath())
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "import-path", conf.ImportPath())
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "originals-path", conf.OriginalsPath())
|
2020-05-25 19:10:44 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "originals-limit", conf.OriginalsLimit())
|
2020-05-31 02:09:52 +02:00
|
|
|
|
|
|
|
// Additional path and file names.
|
|
|
|
fmt.Printf("%-25s %s\n", "static-path", conf.StaticPath())
|
2020-06-26 16:11:56 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "build-path", conf.BuildPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "img-path", conf.ImgPath())
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "templates-path", conf.TemplatesPath())
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "cache-path", conf.CachePath())
|
2020-05-31 02:09:52 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "temp-path", conf.TempPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "config-file", conf.ConfigFile())
|
|
|
|
fmt.Printf("%-25s %s\n", "settings-path", conf.SettingsPath())
|
|
|
|
fmt.Printf("%-25s %t\n", "settings-hidden", conf.SettingsHidden())
|
2020-03-23 20:29:31 +01:00
|
|
|
|
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())
|
|
|
|
fmt.Printf("%-25s %s\n", "exiftool-bin", conf.ExifToolBin())
|
2020-05-13 20:53:15 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "sidecar-json", conf.SidecarJson())
|
2020-05-18 22:18:58 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "sidecar-yaml", conf.SidecarYaml())
|
2020-06-07 10:09:35 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "sidecar-path", conf.SidecarPath())
|
2018-09-24 09:53:16 +02:00
|
|
|
|
2020-12-05 00:13:44 +01:00
|
|
|
// Geo data API.
|
|
|
|
fmt.Printf("%-25s %s\n", "geo-api", conf.GeoApi())
|
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
|
|
|
|
}
|