diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2025-08-14 18:07:12 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2025-08-14 18:07:12 +0100 |
| commit | 4697556cac819c47d068819b9fc9c3b4ea84e279 (patch) | |
| tree | b832d8fc6b643a8b9d0eeca35c1268e1649da731 /internal/config | |
| parent | dd49c9205bb04844b686b9c3396c40eb49d25826 (diff) | |
Merge confplanner-web and replace fiber with native net/http
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 34 |
1 files changed, 34 insertions, 0 deletions
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 +} |
