aboutsummaryrefslogtreecommitdiffstats
path: root/internal/config.go
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-01-17 13:21:24 +0000
committerLeonardo Bishop <me@leonardobishop.com>2025-01-17 13:21:24 +0000
commitc00b690bd6f600554a1404e692bd9e4373325d27 (patch)
tree4488b625e1c24af52fced6f60ac1b3ddff1383bc /internal/config.go
Initial commit
Diffstat (limited to 'internal/config.go')
-rw-r--r--internal/config.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/config.go b/internal/config.go
new file mode 100644
index 0000000..9a1bc5f
--- /dev/null
+++ b/internal/config.go
@@ -0,0 +1,33 @@
+package config
+
+import (
+ "os"
+
+ "gopkg.in/yaml.v3"
+)
+
+type Config struct {
+ Server struct {
+ Host string `yaml:"host"`
+ Port string `yaml:"port"`
+ } `yaml:"server"`
+ Database struct {
+ ConnString string `yaml:"connString"`
+ } `yaml:"database"`
+ Conference struct {
+ ScheduleURL string `yaml:"scheduleURL"`
+ } `yaml:"conference"`
+ AcceptRegistrations bool `yaml:"acceptRegistrations"`
+}
+
+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
+}