move config parsing into a separate module, fix project name
This commit is contained in:
parent
0ab510adef
commit
d6d8b1a9a6
4 changed files with 46 additions and 25 deletions
18
config/config.go
Normal file
18
config/config.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func Parse(path string, spec interface{}) error {
|
||||
configData, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return err
|
||||
}
|
||||
err = yaml.Unmarshal(configData, spec)
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue