blob: 564adbeb74fcb3251b0016f4c3b5d1cbe1031183 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
}
|