mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Config: Improve options report and change BackupRetain default #4243
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -4,14 +4,16 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/list"
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/list"
|
||||
)
|
||||
|
||||
// CliFlag represents a command-line parameter.
|
||||
type CliFlag struct {
|
||||
Flag cli.DocGenerationFlag
|
||||
Tags []string
|
||||
Flag cli.DocGenerationFlag
|
||||
Tags []string
|
||||
DocDefault string
|
||||
}
|
||||
|
||||
// Skip checks if the parameter should be skipped based on a list of tags.
|
||||
@@ -32,6 +34,10 @@ func (f CliFlag) Fields() reflect.Value {
|
||||
|
||||
// Default returns the default value.
|
||||
func (f CliFlag) Default() string {
|
||||
if f.DocDefault != "" {
|
||||
return f.DocDefault
|
||||
}
|
||||
|
||||
return f.Flag.GetValue()
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
const (
|
||||
DefaultBackupSchedule = "0 12 * * *"
|
||||
DefaultBackupRetain = 10
|
||||
DefaultBackupRetain = 3
|
||||
)
|
||||
|
||||
// BackupPath returns the backup storage path based on the specified type, or the base path if none is specified.
|
||||
|
||||
@@ -160,7 +160,7 @@ var Flags = CliFlags{
|
||||
Name: "sidecar-yaml",
|
||||
Usage: "export picture metadata to YAML sidecar files",
|
||||
EnvVar: EnvVar("SIDECAR_YAML"),
|
||||
}}, {
|
||||
}, DocDefault: "true"}, {
|
||||
Flag: cli.StringFlag{
|
||||
Name: "cache-path, ca",
|
||||
Usage: "custom cache `PATH` for sessions and thumbnail files *optional*",
|
||||
@@ -207,12 +207,12 @@ var Flags = CliFlags{
|
||||
Name: "backup-index",
|
||||
Usage: "create index database backups based on the configured schedule",
|
||||
EnvVar: EnvVar("BACKUP_INDEX"),
|
||||
}}, {
|
||||
}, DocDefault: "true"}, {
|
||||
Flag: cli.BoolFlag{
|
||||
Name: "backup-albums",
|
||||
Usage: "export album metadata to YAML backup files",
|
||||
EnvVar: EnvVar("BACKUP_ALBUMS"),
|
||||
}}, {
|
||||
}, DocDefault: "true"}, {
|
||||
Flag: cli.IntFlag{
|
||||
Name: "index-workers, workers",
|
||||
Usage: "maximum `NUMBER` of indexing workers, default depends on the number of physical cores",
|
||||
|
||||
@@ -50,7 +50,7 @@ type Options struct {
|
||||
UsersPath string `yaml:"UsersPath" json:"-" flag:"users-path"`
|
||||
StoragePath string `yaml:"StoragePath" json:"-" flag:"storage-path"`
|
||||
SidecarPath string `yaml:"SidecarPath" json:"-" flag:"sidecar-path"`
|
||||
SidecarYaml bool `yaml:"SidecarYaml" json:"SidecarYaml" flag:"sidecar-yaml"`
|
||||
SidecarYaml bool `yaml:"SidecarYaml" json:"SidecarYaml" flag:"sidecar-yaml" default:"true"`
|
||||
CachePath string `yaml:"CachePath" json:"-" flag:"cache-path"`
|
||||
ImportPath string `yaml:"ImportPath" json:"-" flag:"import-path"`
|
||||
ImportDest string `yaml:"ImportDest" json:"-" flag:"import-dest"`
|
||||
@@ -60,8 +60,8 @@ type Options struct {
|
||||
BackupPath string `yaml:"BackupPath" json:"-" flag:"backup-path"`
|
||||
BackupSchedule string `yaml:"BackupSchedule" json:"BackupSchedule" flag:"backup-schedule"`
|
||||
BackupRetain int `yaml:"BackupRetain" json:"BackupRetain" flag:"backup-retain"`
|
||||
BackupIndex bool `yaml:"BackupIndex" json:"BackupIndex" flag:"backup-index"`
|
||||
BackupAlbums bool `yaml:"BackupAlbums" json:"BackupAlbums" flag:"backup-albums"`
|
||||
BackupIndex bool `yaml:"BackupIndex" json:"BackupIndex" flag:"backup-index" default:"true"`
|
||||
BackupAlbums bool `yaml:"BackupAlbums" json:"BackupAlbums" flag:"backup-albums" default:"true"`
|
||||
IndexWorkers int `yaml:"IndexWorkers" json:"IndexWorkers" flag:"index-workers"`
|
||||
IndexSchedule string `yaml:"IndexSchedule" json:"IndexSchedule" flag:"index-schedule"`
|
||||
WakeupInterval time.Duration `yaml:"WakeupInterval" json:"WakeupInterval" flag:"wakeup-interval"`
|
||||
|
||||
Reference in New Issue
Block a user