aboutsummaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go4
-rw-r--r--internal/config/config.toml2
-rw-r--r--internal/config/config_test.go25
3 files changed, 31 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 4e11c56..9c3c3cd 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -40,6 +40,8 @@ type Config struct {
Width int `toml:"width"`
All bool `toml:"all"`
Offline bool `toml:"offline"`
+ WebTheme string `toml:"web_theme"`
+ WebPort int `toml:"web_port"`
Parts map[string]map[string]bool `toml:"parts"`
}
@@ -65,6 +67,8 @@ func Default() Config {
Width: 0,
All: false,
Offline: false,
+ WebTheme: "transfiguration",
+ WebPort: 0,
Parts: nil,
}
}
diff --git a/internal/config/config.toml b/internal/config/config.toml
index d31e2c4..4ad3289 100644
--- a/internal/config/config.toml
+++ b/internal/config/config.toml
@@ -6,6 +6,8 @@ default_version = "pl" # TUI start / `lectio show` default
width = 0 # CLI wrap width; 0 = detect terminal
all = false # default to all parts (true) or just the gospel (false)
offline = false # true = never fetch; read only harvested sigla + cache
+web_theme = "transfiguration" # built-in order/season theme or a user theme in ~/.config/lectio/themes/
+web_port = 0 # lectio-web port; 0 = auto-pick a free port
# Which parts to show. Both tables are commented out -> every part is shown.
# Uncomment a table and set a part to false to hide it; parts you don't list
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 94c33cd..9b72bc7 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -36,6 +36,31 @@ func TestLoadOverride(t *testing.T) {
}
}
+func TestWebDefaults(t *testing.T) {
+ def := Default()
+ if def.WebTheme != "transfiguration" {
+ t.Errorf("WebTheme default wrong: got %q, want %q", def.WebTheme, "transfiguration")
+ }
+ if def.WebPort != 0 {
+ t.Errorf("WebPort default wrong: got %d, want 0", def.WebPort)
+ }
+}
+
+func TestWebLoadsFromSeed(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ cfg, err := Load()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if cfg.WebTheme != "transfiguration" {
+ t.Errorf("WebTheme from seed wrong: got %q, want %q", cfg.WebTheme, "transfiguration")
+ }
+ if cfg.WebPort != 0 {
+ t.Errorf("WebPort from seed wrong: got %d, want 0", cfg.WebPort)
+ }
+}
+
func TestPartShown(t *testing.T) {
var empty Config
if !empty.PartShown("new", "psalm") {