diff options
| author | Leonardo Bishop <me@leonardobishop.net> | 2025-09-09 22:44:09 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.net> | 2025-09-09 22:44:09 +0100 |
| commit | f1741a7faa9538e9b12ac60e0fbf6c7721a36059 (patch) | |
| tree | 2b70b14fc20a8520718910a0cd2e0134790c6f53 /internal | |
Initial commit
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/config/config.go | 27 | ||||
| -rw-r--r-- | internal/constants/constants.go | 3 |
2 files changed, 30 insertions, 0 deletions
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 +} diff --git a/internal/constants/constants.go b/internal/constants/constants.go new file mode 100644 index 0000000..2a98dfd --- /dev/null +++ b/internal/constants/constants.go @@ -0,0 +1,3 @@ +package constants + +var SysConfPrefix string |
