feat: add agent user nodes with access token authentication
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Successful in 1m50s
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Successful in 51s
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 53s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 48s
Build and Publish Docker Image / build-and-push-docker (push) Successful in 12m50s

This commit is contained in:
2026-06-12 01:54:08 +02:00
parent 6421c28191
commit 83f015cb95
8 changed files with 143 additions and 20 deletions
+6
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"strconv"
)
@@ -42,6 +43,11 @@ func (c *apiClient) do(method, path string, body any) (*http.Response, error) {
// setAuth attaches either a Bearer token (when a session exists) or the
// X-Ax-User header (no session / non-OIDC servers).
func (c *apiClient) setAuth(req *http.Request) error {
// Agent token takes priority (stateless, no login needed).
if token := os.Getenv("AX_TOKEN"); token != "" {
req.Header.Set("Authorization", "Bearer "+token)
return nil
}
sess, err := store.LoadSession()
if err != nil || sess == nil || sess.Token == "" {
req.Header.Set("X-Ax-User", c.user)