Some Refactoring.

This commit is contained in:
rony5394
2026-03-22 21:16:58 +01:00
parent be06e3b87c
commit ec797025e5
9 changed files with 299 additions and 234 deletions

22
main.go
View File

@@ -1,42 +1,26 @@
package main
import (
"encoding/json"
"os"
"github.com/rony5394/blazena/docker"
"github.com/rony5394/blazena/host"
cfg "github.com/rony5394/blazena/config"
);
var Config cfg.Config = cfg.Config{
Nodes: make(map[string]struct{Ip string; DockerVolumePath string}),
};
func main() {
if(len(os.Args) < 2){
panic("Usage: blazena <mode>");
}
rawConfig, err := os.ReadFile("./config.json");
if err != nil{
panic("Failed it load config file." + err.Error());
}
err = json.Unmarshal(rawConfig, &Config);
if err != nil{
panic("Failed to unmarshal config." + err.Error())
}
var config = cfg.GetConfig();
mode := os.Args[1];
switch mode {
case "docker":
docker.Run(Config);
docker.Run(config);
break;
case "host":
host.Run(Config);
host.Run(config);
break;
default:
panic("Invalid runtime mode!");