refactor: consolidate packages - move output to cmd, config/session to store, rename Store to GraphStore

This commit is contained in:
2026-04-02 00:18:33 +02:00
parent 2bcc310c6d
commit 03a896d23f
25 changed files with 190 additions and 239 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
package serve
import (
"axolotl/service"
"axolotl/store"
"context"
"crypto/rand"
"crypto/sha256"
@@ -30,12 +30,12 @@ type authHandler struct {
pending map[string]*pendingLogin // loginID → pending state
sessions map[string]string // serverToken → username
cfg service.OIDCConfig
cfg store.OIDCConfig
provider *oidc.Provider
oauth2 oauth2.Config
}
func newAuthHandler(cfg service.OIDCConfig) (*authHandler, error) {
func newAuthHandler(cfg store.OIDCConfig) (*authHandler, error) {
if cfg.PublicURL == "" {
return nil, fmt.Errorf("oidc.public_url must be set to the externally reachable base URL of this server")
}
+5 -3
View File
@@ -3,6 +3,7 @@ package serve
import (
"axolotl/models"
"axolotl/service"
"axolotl/store"
"encoding/json"
"net/http"
"strings"
@@ -12,7 +13,7 @@ import (
// When oidcCfg is non-nil, every request must carry a valid Bearer token;
// the authenticated username is derived from the token claim configured in
// OIDCConfig.UserClaim. Without OIDC, the X-Ax-User header is used instead.
func New(newSvc func(user string) (service.NodeService, error), oidcCfg *service.OIDCConfig) (http.Handler, error) {
func New(newSvc func(user string) (service.NodeService, error), oidcCfg *store.OIDCConfig) (http.Handler, error) {
s := &server{newSvc: newSvc}
mux := http.NewServeMux()
mux.HandleFunc("GET /nodes", s.listNodes)
@@ -191,8 +192,9 @@ func parseRel(s string) service.RelInput {
if strings.Contains(s, "::") {
return service.RelInput{Type: models.RelType(s)}
}
if idx := strings.Index(s, ":"); idx >= 0 {
return service.RelInput{Type: models.RelType(s[:idx]), Target: s[idx+1:]}
if before, after, found := strings.Cut(s, ":"); found {
return service.RelInput{Type: models.RelType(before), Target: after}
}
return service.RelInput{Type: models.RelType(s)}
}