init(web): add loading configuration from file

This commit is contained in:
2025-01-07 17:03:45 +03:00
parent b42542931a
commit 1acb32aea0
2 changed files with 34 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package conf
import (
"os"
"gopkg.in/yaml.v3"
)
const CONF_FILE = "/etc/skazanull/web.conf.yml"
type Conf struct {
DBConfig string `yaml:"db_config"`
Interface string `yaml:"interface"`
EncryptionKey string `yaml:"encryption_key"`
}
func GetConf() (conf Conf, err error) {
confFile, err := os.ReadFile(CONF_FILE)
if err != nil {
return
}
err = yaml.Unmarshal(confFile, &conf)
return
}