Merge pull request #181 from ZeusWPI/feature/179
Update script to read admins from configuration file
This commit is contained in:
commit
fb3e7b95f1
3 changed files with 8 additions and 18 deletions
|
@ -26,7 +26,7 @@ Afterwards upgrade the database to the latest version using
|
||||||
cd app
|
cd app
|
||||||
python3 app.py db upgrade
|
python3 app.py db upgrade
|
||||||
|
|
||||||
You can now still seed the database by running
|
You can now still seed the database by running, note that you might want to put your name in the `HALDIS_ADMIN_USERS` in `app/config.py`
|
||||||
|
|
||||||
./populate-db.sh
|
./populate-db.sh
|
||||||
|
|
||||||
|
|
|
@ -2,24 +2,13 @@
|
||||||
from models import User
|
from models import User
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
|
from models import User
|
||||||
|
from config import Configuration
|
||||||
|
|
||||||
|
|
||||||
def add() -> None:
|
def add() -> None:
|
||||||
"""Add users as admin."""
|
"""Add users as admin."""
|
||||||
feli = User()
|
for username in Configuration.HALDIS_ADMINS:
|
||||||
feli.configure("feliciaan", True, 0)
|
user = User()
|
||||||
db.session.add(feli)
|
user.configure(username, True, 0)
|
||||||
|
db.session.add(user)
|
||||||
destro = User()
|
|
||||||
destro.configure("destro", True, 0)
|
|
||||||
db.session.add(destro)
|
|
||||||
|
|
||||||
iepoev = User()
|
|
||||||
iepoev.configure("iepoev", True, 1)
|
|
||||||
db.session.add(iepoev)
|
|
||||||
|
|
||||||
flynn = User()
|
|
||||||
flynn.configure("flynn", True, 0)
|
|
||||||
db.session.add(flynn)
|
|
||||||
|
|
||||||
# To future developers, add yourself here
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ class Configuration:
|
||||||
SQLALCHEMY_DATABASE_URI = "sqlite:///haldis.db"
|
SQLALCHEMY_DATABASE_URI = "sqlite:///haldis.db"
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
HALDIS_ADMIN_USERS = []
|
||||||
SECRET_KEY = "<change>"
|
SECRET_KEY = "<change>"
|
||||||
SLACK_WEBHOOK = None
|
SLACK_WEBHOOK = None
|
||||||
LOGFILE = "haldis.log"
|
LOGFILE = "haldis.log"
|
||||||
|
|
Loading…
Reference in a new issue