From 4697556cac819c47d068819b9fc9c3b4ea84e279 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 14 Aug 2025 18:07:12 +0100 Subject: Merge confplanner-web and replace fiber with native net/http --- internal/config/config.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 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..564adbe --- /dev/null +++ b/internal/config/config.go @@ -0,0 +1,34 @@ +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"` + BaseURL string `yaml:"baseURL"` +} + +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