authentification groundworks

This commit is contained in:
Mitsu
2025-07-11 08:30:53 +02:00
parent 5e9433f4ae
commit e411536477
7 changed files with 122 additions and 4 deletions
+10 -1
View File
@@ -15,10 +15,19 @@ import (
func StartHTTPServer() {
router := http.NewServeMux()
router.HandleFunc("GET /api/v1/id/{ID}", getCurrent)
router.HandleFunc("PUT /api/v1/id/{ID}", setCurrent)
if !db.ControllerExists(0) {
adminToken := db.CreateAdmin()
fmt.Println("IMPORTANT")
fmt.Println("- - - - - - - - - - - - - - - - - - ")
fmt.Println("ADMIN TOKEN:")
fmt.Printf("%s\n", adminToken)
fmt.Println("REGENERATE THE TOKEN BY RUNNING WITH -resetAdminToken")
fmt.Println("- - - - - - - - - - - - - - - - - - ")
}
port := config.AppConfig.HTTP.Port
logger.HTTPLogger.Printf("HTTP Server running on :%v", port)
http.ListenAndServe(fmt.Sprintf(":%d", port), router)