fix (boot): bootup sequence

This commit is contained in:
MickaelK 2025-07-21 17:33:38 +10:00
parent 8a36ba943a
commit 471791c679
2 changed files with 5 additions and 3 deletions

View file

@ -13,8 +13,8 @@ var (
logfile *os.File
)
func InitLogger() error {
logfile, err := os.OpenFile(GetAbsolutePath(LOG_PATH, "access.log"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, os.ModePerm)
func InitLogger() (err error) {
logfile, err = os.OpenFile(GetAbsolutePath(LOG_PATH, "access.log"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, os.ModePerm)
if err != nil {
slog.Printf("ERROR log file: %+v", err)
return err

View file

@ -21,11 +21,12 @@ var listOfPlugins = struct {
apps []string
}{}
func InitPluginList(code []byte, plgs map[string]model.PluginImpl) {
func InitPluginList(code []byte, plgs map[string]model.PluginImpl) error {
listOfPackages := regexp.MustCompile(`\t_?\s*\"(github.com/[^\"]+)`).FindAllStringSubmatch(string(code), -1)
for _, packageNameMatch := range listOfPackages {
if len(packageNameMatch) != 2 {
Log.Error("ctrl::static error=assertion_failed msg=invalid_match_size arg=%d", len(packageNameMatch))
return ErrNotValid
}
packageName := packageNameMatch[1]
packageShortName := filepath.Base(packageName)
@ -43,6 +44,7 @@ func InitPluginList(code []byte, plgs map[string]model.PluginImpl) {
for name, _ := range plgs {
listOfPlugins.apps = append(listOfPlugins.apps, name)
}
return nil
}
func AboutHandler(ctx *App, res http.ResponseWriter, req *http.Request) {