package main import ( "backend/core" "backend/server" "backend/util" "errors" "os" ) func main() { // Set Log Level util.SetLevel(util.NOLOG) cfg, err := util.ReadConfig("config.json") if err != nil { if errors.Is(err, os.ErrNotExist) { util.Logformat(util.INFO, "Creating config file...\n") util.CreateConfig() cfg, _ = util.ReadConfig("config.json") } else { util.Logformat(util.ERROR, "Could not read configuration file: %s\n", err.Error()) os.Exit(2) } } // Reading files util.Logformat(util.INFO, "Reading folder '%s'\n", cfg.PhotoPath) err = core.ListFiles(cfg.PhotoPath) if err != nil { util.Logformat(util.ERROR, "%s\n", err.Error()) os.Exit(3) } // Rest API start on port server.Start(8085) }