Added configuration file to BPM

This commit is contained in:
2024-05-29 21:30:22 +03:00
parent 8db2635314
commit ea469c4180
10 changed files with 64 additions and 14 deletions
+29
View File
@@ -0,0 +1,29 @@
package bpm_utils
import (
"gopkg.in/yaml.v3"
"os"
)
type BPMConfigStruct struct {
CompilationEnv []string `yaml:"compilation_env"`
SilentCompilation bool `yaml:"silent_compilation"`
}
var BPMConfig BPMConfigStruct = BPMConfigStruct{
CompilationEnv: make([]string, 0),
SilentCompilation: false}
func ReadConfig() {
if _, err := os.Stat("/etc/bpm.conf"); os.IsNotExist(err) {
return
}
bytes, err := os.ReadFile("/etc/bpm.conf")
if err != nil {
return
}
err = yaml.Unmarshal(bytes, &BPMConfig)
if err != nil {
return
}
}