Commit 97c8491b authored by JackV's avatar JackV
Browse files

Revert uus management split

This reverts commit 805d4729.
parent d2ab8626
......@@ -9,7 +9,8 @@ RUN apk add -U python3 py3-gunicorn && \
ENV FLASK_APP=uus
COPY uus_mng /
COPY uus.py /uus
COPY admin /uus/admin
EXPOSE 8000
......
......@@ -8,9 +8,9 @@ Also, `FLASK_APP=uus` must be set when not running in Docker (the Dockerfile alr
Run `flask` to get the list of commands.
In the docker container you can run `uus_mng` directly to get to the CLI, for example
In the docker container you can run `uus` directly to get to the CLI, for example
```
$ docker exec -it uus_uus_1 /uus_mng adduser admin
$ docker exec -it uus_uus_1 uus adduser admin
Password:
```
\ No newline at end of file
#!/usr/bin/env python3
import crypt
import click
import redis
import os
redis_store = None
default_redis_url = os.environ.get('REDIS_URL', 'redis://127.0.0.1:6379/0')
import click
@click.group()
@click.option("--redisurl", "-u", help="Redis DB url", default=default_redis_url)
def cli(redisurl):
global redis_store
redis_store = redis.from_url(redisurl)
from . import app, redis_store, redis_key_for_user
@cli.command()
@app.cli.command()
@click.argument("username")
@click.option("--passwd", "-p", prompt="Password", help="Password", hide_input=True)
def adduser(username, passwd):
"""Add UUS admin user"""
cryptpwd = crypt.crypt(passwd)
redis_store.set('usr.' + username, cryptpwd)
redis_store.set(redis_key_for_user(username), cryptpwd)
@cli.command()
@app.cli.command()
@click.argument("username")
@click.option("--passwd", "-p", prompt="Password", help="Password", hide_input=True)
def passwd(username, passwd):
......@@ -32,12 +22,8 @@ def passwd(username, passwd):
adduser(username, passwd)
@cli.command()
@app.cli.command()
@click.argument("username")
def deluser(username):
"""Delete UUS admin user"""
redis_store.delete('usr.' + username)
if __name__ == '__main__':
cli()
redis_store.delete(redis_key_for_user(username))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment