feat: implement GEWU service and local agent workflows
CI / quality (push) Canceled after 0s

This commit is contained in:
vasily committed 2026-10-14 19:21:35 +08:00
1 parent 4db3f45164
commit d25c04cdd2
175 files changed
+56243 -15

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
"""Provision one local service credential; the bearer key is shown only once."""
from __future__ import annotations
import argparse
import os
from pathlib import Path
from gewu.adapters.sqlite_identity import SQLiteIdentityStore
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--credential-id", required=True)
parser.add_argument("--principal-id", required=True)
parser.add_argument(
"--role", action="append", choices=("admin", "editor", "viewer", "agent"), required=True
)
parser.add_argument("--project", action="append", default=[])
arguments = parser.parse_args()
data_root = Path(os.environ.get("GEWU_DATA_ROOT", "./.data/gewu")).expanduser().absolute()
data_root.mkdir(parents=True, exist_ok=True, mode=0o700)
token = SQLiteIdentityStore(data_root / "identity.sqlite3").provision(
credential_id=arguments.credential_id,
principal_id=arguments.principal_id,
roles=tuple(arguments.role),
project_ids=tuple(arguments.project),
)
print("Store this bearer credential securely; it cannot be displayed again:")
print(token)
if __name__ == "__main__":
main()