diff --git a/argos/commands.py b/argos/commands.py index ec694e5..dda39dc 100644 --- a/argos/commands.py +++ b/argos/commands.py @@ -1,6 +1,7 @@ import asyncio import os from functools import wraps +from uuid import uuid4 import click import uvicorn @@ -167,5 +168,15 @@ async def migrate(): command.upgrade(alembic_cfg, "head") +@server.command() +@coroutine +async def generate_token(): + """Generate a token, which can be used as an agent’s authentication token. + + It’s actually an UUID + """ + click.echo(uuid4()) + + if __name__ == "__main__": cli() diff --git a/docs/cli.md b/docs/cli.md index 711f834..5969771 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -26,14 +26,14 @@ Options: --help Show this message and exit. Commands: - agent Get and run tasks to the provided server. + agent Get and run tasks to the provided server. server ``` -## Agent commands +## Agent command +### Server generate-token command + + + +```man +Usage: argos server generate-token [OPTIONS] + + Generate a token, which can be used as an agent’s authentication token. + + It’s actually an UUID + +Options: + --help Show this message and exit. +``` + +