platform: modularize api/gui, add docs-tests-web foundation, and refresh root config

This commit is contained in:
beckline
2026-03-26 22:40:54 +03:00
parent 0e2d7f61ea
commit 6a56d734c2
562 changed files with 70151 additions and 16423 deletions

View File

@@ -0,0 +1,38 @@
package app
import (
"context"
"errors"
"log"
"net/http"
appbootstrap "selective-vpn-api/app/bootstrap"
"time"
)
func runAPIServerAtAddr(addr string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
prepareAPIRuntime()
log.Printf("selective-vpn API listening on %s", addr)
if err := appbootstrap.Run(ctx, appbootstrap.Config{
Addr: addr,
ReadHeaderTimeout: 5 * time.Second,
RegisterRoutes: registerAPIRoutes,
WrapHandler: logRequests,
StartWatchers: startWatchers,
}); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatalf("server error: %v", err)
}
}
func prepareAPIRuntime() {
ensureSeeds()
if err := ensureAppMarksNft(); err != nil {
log.Printf("traffic appmarks nft init warning: %v", err)
}
if err := restoreAppMarksFromState(); err != nil {
log.Printf("traffic appmarks restore warning: %v", err)
}
}