diff --git a/aid/config.go b/aid/config.go index 427ffc9..4bf3d4b 100644 --- a/aid/config.go +++ b/aid/config.go @@ -1,7 +1,6 @@ package aid import ( - "os" "strconv" "strings" @@ -35,15 +34,10 @@ var ( Config *CS ) -func LoadConfig() { +func LoadConfig(file []byte) { Config = &CS{} - - configPath := "config.ini" - if _, err := os.Stat(configPath); err != nil { - panic("config.ini not found! please rename default.config.ini to config.ini and complete") - } - - cfg, err := ini.Load("config.ini") + + cfg, err := ini.Load(file) if err != nil { panic(err) } diff --git a/main.go b/main.go index 81e76a9..342e98f 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + _ "embed" "fmt" "github.com/ectrc/snow/aid" @@ -11,8 +12,12 @@ import ( "github.com/gofiber/fiber/v2" ) + +//go:embed config.ini +var configFile []byte + func init() { - aid.LoadConfig() + aid.LoadConfig(configFile) var device storage.Storage switch aid.Config.Database.Type {