From f1741a7faa9538e9b12ac60e0fbf6c7721a36059 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Tue, 9 Sep 2025 22:44:09 +0100 Subject: Initial commit --- internal/config/config.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 internal/config/config.go (limited to 'internal/config/config.go') diff --git a/internal/config/config.go b/internal/config/config.go new file mode 100644 index 0000000..98ae805 --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,27 @@ +package config + +import ( + "os" + + "gopkg.in/yaml.v3" +) + +type Config struct { + Server struct { + Host string `yaml:"host"` + Port string `yaml:"port"` + } `yaml:"server"` + Token string `yaml:"token"` +} + +func ReadConfig(configPath string, dst *Config) error { + config, err := os.ReadFile(configPath) + if err != nil { + return err + } + + if err := yaml.Unmarshal(config, dst); err != nil { + return err + } + return nil +} -- cgit v1.2.3-70-g09d2