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-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s VALUE\n", "NAME")
|
2020-05-05 17:04:13 +02:00
|
|
|
|
|
|
|
// Description
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "name", conf.Name())
|
|
|
|
fmt.Printf("%-25s %s\n", "url", conf.Url())
|
|
|
|
fmt.Printf("%-25s %s\n", "title", conf.Title())
|
|
|
|
fmt.Printf("%-25s %s\n", "subtitle", conf.Subtitle())
|
|
|
|
fmt.Printf("%-25s %s\n", "description", conf.Description())
|
|
|
|
fmt.Printf("%-25s %s\n", "author", conf.Author())
|
|
|
|
fmt.Printf("%-25s %s\n", "version", conf.Version())
|
|
|
|
fmt.Printf("%-25s %s\n", "copyright", conf.Copyright())
|
2020-05-05 17:04:13 +02:00
|
|
|
|
|
|
|
// Flags
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "debug", conf.Debug())
|
|
|
|
fmt.Printf("%-25s %t\n", "read-only", conf.ReadOnly())
|
|
|
|
fmt.Printf("%-25s %t\n", "public", conf.Public())
|
|
|
|
fmt.Printf("%-25s %t\n", "experimental", conf.Experimental())
|
2020-05-05 17:04:13 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "disable-settings", conf.DisableSettings())
|
|
|
|
|
|
|
|
// TensorFlow
|
|
|
|
fmt.Printf("%-25s %t\n", "disable-tf", conf.DisableTensorFlow())
|
|
|
|
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-05 18:26:44 +02:00
|
|
|
// Passwords
|
|
|
|
fmt.Printf("%-25s %s\n", "admin-password", conf.AdminPassword())
|
|
|
|
fmt.Printf("%-25s %s\n", "webdav-password", conf.WebDAVPassword())
|
|
|
|
|
2020-05-05 17:04:13 +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())
|
2020-05-05 17:04:13 +02:00
|
|
|
|
|
|
|
// Path and file names
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "log-filename", conf.LogFilename())
|
|
|
|
fmt.Printf("%-25s %s\n", "pid-filename", conf.PIDFilename())
|
|
|
|
fmt.Printf("%-25s %s\n", "config-file", conf.ConfigFile())
|
|
|
|
fmt.Printf("%-25s %s\n", "config-path", conf.ConfigPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "assets-path", conf.AssetsPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "originals-path", conf.OriginalsPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "import-path", conf.ImportPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "temp-path", conf.TempPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "cache-path", conf.CachePath())
|
|
|
|
fmt.Printf("%-25s %s\n", "resources-path", conf.ResourcesPath())
|
2020-05-05 18:26:44 +02:00
|
|
|
|
|
|
|
// HTTP server config
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "favicons-path", conf.HttpFaviconsPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "static-path", conf.HttpStaticPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "static-build-path", conf.HttpStaticBuildPath())
|
2020-05-05 18:26:44 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "templates-path", conf.HttpTemplatesPath())
|
|
|
|
fmt.Printf("%-25s %s\n", "http-template", conf.HttpDefaultTemplate())
|
2020-05-05 15:42:54 +02:00
|
|
|
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())
|
2020-03-23 20:29:31 +01:00
|
|
|
|
2020-05-05 18:26:44 +02:00
|
|
|
// Built-in TiDB server config
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "tidb-host", conf.TidbServerHost())
|
|
|
|
fmt.Printf("%-25s %d\n", "tidb-port", conf.TidbServerPort())
|
|
|
|
fmt.Printf("%-25s %s\n", "tidb-password", conf.TidbServerPassword())
|
|
|
|
fmt.Printf("%-25s %s\n", "tidb-path", conf.TidbServerPath())
|
2020-03-23 20:29:31 +01:00
|
|
|
|
2020-05-05 17:04:13 +02:00
|
|
|
// Database config
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "database-driver", conf.DatabaseDriver())
|
|
|
|
fmt.Printf("%-25s %s\n", "database-dsn", conf.DatabaseDsn())
|
2020-03-23 20:29:31 +01:00
|
|
|
|
2020-05-05 17:04:13 +02:00
|
|
|
// External binaries
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "sips-bin", conf.SipsBin())
|
|
|
|
fmt.Printf("%-25s %s\n", "darktable-bin", conf.DarktableBin())
|
|
|
|
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-05-19 11:00:17 +02:00
|
|
|
fmt.Printf("%-25s %t\n", "sidecar-hidden", conf.SidecarHidden())
|
2018-09-24 09:53:16 +02:00
|
|
|
|
2020-05-05 17:04:13 +02:00
|
|
|
// Places / Geocoding API
|
2020-05-05 15:42:54 +02:00
|
|
|
fmt.Printf("%-25s %s\n", "geocoding-api", conf.GeoCodingApi())
|
2020-05-05 17:04:13 +02:00
|
|
|
|
|
|
|
// Thumbnails
|
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())
|
|
|
|
fmt.Printf("%-25s %d\n", "thumb-limit", conf.ThumbLimit())
|
|
|
|
fmt.Printf("%-25s %s\n", "thumb-path", conf.ThumbPath())
|
2020-05-19 11:00:17 +02:00
|
|
|
fmt.Printf("%-25s %d\n", "jpeg-quality", conf.JpegQuality())
|
|
|
|
fmt.Printf("%-25s %t\n", "jpeg-hidden", conf.JpegHidden())
|
2020-04-12 18:00:31 +02:00
|
|
|
|
2018-09-24 09:53:16 +02:00
|
|
|
return nil
|
|
|
|
}
|