mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 09:52:38 +02:00
✨ — Add a command to generate an auth token (fix #22)
This commit is contained in:
parent
e264f8a068
commit
168788eb89
2 changed files with 37 additions and 5 deletions
|
@ -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()
|
||||
|
|
31
docs/cli.md
31
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
|
||||
```
|
||||
|
||||
<!--[[[end]]]
|
||||
-->
|
||||
|
||||
## Agent commands
|
||||
## Agent command
|
||||
<!--
|
||||
.. [[[cog
|
||||
help(["agent", "--help"])
|
||||
|
@ -77,9 +77,10 @@ Options:
|
|||
--help Show this message and exit.
|
||||
|
||||
Commands:
|
||||
cleandb Clean the database (to run routinely)
|
||||
migrate Run database migrations
|
||||
reload-config Read tasks config and add/delete tasks in database if...
|
||||
cleandb Clean the database (to run routinely)
|
||||
generate-token Generate a token, which can be used as an agent’s...
|
||||
migrate Run database migrations
|
||||
reload-config Read tasks config and add/delete tasks in database if...
|
||||
start Starts the server
|
||||
```
|
||||
|
||||
|
@ -172,3 +173,23 @@ Options:
|
|||
<!--[[[end]]]
|
||||
-->
|
||||
|
||||
### Server generate-token command
|
||||
|
||||
<!--
|
||||
.. [[[cog
|
||||
help(["server", "generate-token", "--help"])
|
||||
.. ]]] -->
|
||||
|
||||
```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.
|
||||
```
|
||||
|
||||
<!--[[[end]]]
|
||||
-->
|
||||
|
|
Loading…
Reference in a new issue