Make dashboard updateable
This commit is contained in:
13
config.go
13
config.go
@@ -35,6 +35,7 @@ type Config struct {
|
||||
Paths PathConfig `toml:"paths"`
|
||||
Threads ThreadConfig `toml:"threads"`
|
||||
Cache CacheConfig `toml:"cache"`
|
||||
Editing EditingConfig `toml:"editing"`
|
||||
}
|
||||
|
||||
type DisplayConfig struct {
|
||||
@@ -60,6 +61,10 @@ type CacheConfig struct {
|
||||
Directory string `toml:"directory"`
|
||||
}
|
||||
|
||||
type EditingConfig struct {
|
||||
Mode string `toml:"mode"`
|
||||
}
|
||||
|
||||
func defaultConfig() Config {
|
||||
return Config{
|
||||
Theme: "dark",
|
||||
@@ -80,7 +85,8 @@ func defaultConfig() Config {
|
||||
StatusOrder: []string{"unresolved", "outdated", "resolved"},
|
||||
WithinStatus: "file",
|
||||
},
|
||||
Cache: CacheConfig{Enabled: true, MaxAge: configDuration{7 * 24 * time.Hour}},
|
||||
Cache: CacheConfig{Enabled: true, MaxAge: configDuration{7 * 24 * time.Hour}},
|
||||
Editing: EditingConfig{Mode: "vim"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +176,11 @@ func validateConfig(config Config) error {
|
||||
if config.Cache.MaxAge.Duration < 0 {
|
||||
return fmt.Errorf("cache.max_age must not be negative")
|
||||
}
|
||||
switch config.Editing.Mode {
|
||||
case "standard", "vim":
|
||||
default:
|
||||
return fmt.Errorf("editing.mode must be standard or vim")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user