summaryrefslogtreecommitdiffstats
path: root/internal/config
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go27
1 files changed, 27 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
+}