forked from mirrors/thatmattlove-hyperglass
add secret generator
This commit is contained in:
parent
71070a7e5f
commit
5365db9550
1 changed files with 14 additions and 0 deletions
14
manage.py
14
manage.py
|
|
@ -832,5 +832,19 @@ def fixpermissions(user, group):
|
|||
raise
|
||||
|
||||
|
||||
@hg.command("generate-secret", help="Generate agent secret")
|
||||
@click.option("-l", "--length", default=32, help="Secret length")
|
||||
def generate_secret(length):
|
||||
import secrets
|
||||
|
||||
gen_secret = secrets.token_urlsafe(length)
|
||||
click.echo(
|
||||
NL
|
||||
+ click.style("Secret: ", fg="white")
|
||||
+ click.style(gen_secret, fg="magenta", bold=True)
|
||||
+ NL
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
hg()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue