mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 02:26:12 +00:00
Added configuration file to BPM
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user