This repository has been archived on 2026-03-18. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
lotus-package-manager/Lotus/ConfigHandler.go
2021-11-09 10:39:46 +01:00

38 lines
511 B
Go

package Lotus
import (
"encoding/json"
"os"
)
type Config struct{
Registries []Registry
}
type Registry struct {
Address string
Register string
}
func readConfig() []byte {
file, err := os.ReadFile("config/registylist.json")
if err != nil {
logger.Fatal(err)
}
return file
}
func GetRegistries() []Registry{
logger := Logger("ConfigHandler")
var registires []Registry
err := json.Unmarshal([]byte(readConfig()), &registires)
if err != nil {
logger.Fatal(err)
}
return registires
}