mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Added basic remote repository functionality
This commit is contained in:
+16
-7
@@ -2,14 +2,16 @@ package utils
|
||||
|
||||
import (
|
||||
"gopkg.in/yaml.v3"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
type BPMConfigStruct struct {
|
||||
CompilationEnv []string `yaml:"compilation_env"`
|
||||
SilentCompilation bool `yaml:"silent_compilation"`
|
||||
BinaryOutputDir string `yaml:"binary_output_dir"`
|
||||
CompilationDir string `yaml:"compilation_dir"`
|
||||
CompilationEnv []string `yaml:"compilation_env"`
|
||||
SilentCompilation bool `yaml:"silent_compilation"`
|
||||
BinaryOutputDir string `yaml:"binary_output_dir"`
|
||||
CompilationDir string `yaml:"compilation_dir"`
|
||||
Repositories []*Repository `yaml:"repositories"`
|
||||
}
|
||||
|
||||
var BPMConfig BPMConfigStruct = BPMConfigStruct{
|
||||
@@ -21,14 +23,21 @@ var BPMConfig BPMConfigStruct = BPMConfigStruct{
|
||||
|
||||
func ReadConfig() {
|
||||
if _, err := os.Stat("/etc/bpm.conf"); os.IsNotExist(err) {
|
||||
return
|
||||
log.Fatal(err)
|
||||
}
|
||||
bytes, err := os.ReadFile("/etc/bpm.conf")
|
||||
if err != nil {
|
||||
return
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = yaml.Unmarshal(bytes, &BPMConfig)
|
||||
if err != nil {
|
||||
return
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, repo := range BPMConfig.Repositories {
|
||||
repo.Entries = make(map[string]*RepositoryEntry)
|
||||
err := repo.ReadLocalDatabase()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user