From 103e84d847262830bbaa550b37218e9ca8b317d3 Mon Sep 17 00:00:00 2001 From: Himanshu Sardana Date: Thu, 26 Mar 2026 21:26:35 +0000 Subject: refactor: split into cmd, pkg --- pkg/config/config.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkg/config/config.go (limited to 'pkg/config') diff --git a/pkg/config/config.go b/pkg/config/config.go new file mode 100644 index 0000000..56f40aa --- /dev/null +++ b/pkg/config/config.go @@ -0,0 +1,29 @@ +package config + +import ( + "os" + + "gopkg.in/yaml.v2" +) + +type Config struct { + SiteTitle string `yaml:"siteTitle"` + AuthorName string `yaml:"authorName"` + AuthorRole string `yaml:"authorRole"` + AuthorBio string `yaml:"authorBio"` + DefaultTheme string `yaml:"defaultTheme"` +} + +func Load(path string) (*Config, error) { + data, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + var cfg Config + if err := yaml.Unmarshal(data, &cfg); err != nil { + return nil, err + } + + return &cfg, nil +} -- cgit v1.3.1