Restructure token store by remote id

This commit is contained in:
mpabi
2026-04-26 22:12:45 +02:00
parent d2d200257f
commit 55c52c7b4f
5 changed files with 768 additions and 352 deletions
+16 -16
View File
@@ -86,7 +86,8 @@ Masz dwie drogi.
To jest wariant dydaktyczny, jesli uczen ma cwiczyc reczne dodawanie remota z
tokenem do konkretnego zdalnego endpointu. Jesli launcher zobaczy URL w formacie
`http://LOGIN:TOKEN@...`, zapisze ten token lokalnie do `tokens/tokens.json`.
`http://LOGIN:TOKEN@...`, mozesz zapisac ten token lokalnie komenda
`tokens sync remote r1`.
Przyklad:
@@ -115,7 +116,7 @@ Minimalny format:
"version": 3,
"tokens": [
{
"token_id": "t1",
"id": "r1",
"value": "TU_WSTAW_TOKEN",
"server": {
"type": "gitea",
@@ -124,13 +125,9 @@ Minimalny format:
"host": "77.90.8.171",
"port": 3001
},
"remotes": [
{
"name": "r1",
"org": "edu-tools",
"repo": "rv-launcher"
}
]
"user": "u1",
"org": "edu-tools",
"repo": "rv-launcher"
}
]
}
@@ -159,7 +156,10 @@ Podstawowe komendy tokenow:
```bash
./rvctl tokens scan
./rvctl tokens add t1
./rvctl tokens sync remote r1
./rvctl tokens update r1
./rvctl tokens sync store r1
./rvctl tokens add r1
./rvctl tokens read
./rvctl tokens stats --repo ~/dev/workspace/rv/series/inf/03
```
@@ -167,12 +167,12 @@ Podstawowe komendy tokenow:
`tokens scan` wypisuje tabele `tokens` i niczego nie zapisuje: jeden wiersz na
logiczny remote tokena.
`token_ref` laczy nazwe tokena z markerem po prawej stronie: `*` oznacza, ze
remote i `tokens.json` sa zgodne oraz uprawnienia zostaly wczytane, `R` oznacza
token tylko w remote, a `S` token tylko w `tokens.json`. Kolumny `scope`, `org`
i `repo` sa maskami uprawnien; bez `*` maja wartosc `?????????`, `?????`
albo `????`.
Zapis z remote do `tokens.json` oraz odczyt `valid` i uprawnien z API robi
dopiero `tokens update --from remotes`.
remote i `tokens.json` sa zgodne, `R` oznacza token tylko w remote, a `S`
token tylko w `tokens.json`. Kolumny `scope`, `org` i `repo` sa maskami
uprawnien; bez zgodnego wpisu maja wartosc `?????????`, `?????` albo `????`.
Zapis z remote do `tokens.json` robi `tokens sync remote r1`.
Odczyt `valid` i uprawnien z API robi `tokens update r1`.
Zapis z `tokens.json` do remota robi `tokens sync store r1`.
Kolumna `valid` oznacza, czy token zostal zaakceptowany przez API teraz.
Jesli przy tokenie w `tokens.json` zapiszesz `expires_at`, `valid` moze pokazac
date wygasniecia; bez daty poprawny token pokazuje `forever`.