Update script to read admins from configuration file

This commit is contained in:
Jan-Pieter Baert 2022-04-19 20:08:29 +02:00
parent 461664f629
commit 492d1ca91c
No known key found for this signature in database
GPG key ID: C61C42632C5952F3
2 changed files with 7 additions and 17 deletions

View file

@ -2,24 +2,13 @@
from models import User
from app import db
from models import User
from config import Configuration
def add() -> None:
"""Add users as admin."""
feli = User()
feli.configure("feliciaan", True, 0)
db.session.add(feli)
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
for username in Configuration.HALDIS_ADMINS:
user = User()
user.configure(username, True, 0)
db.session.add(user)

View file

@ -8,6 +8,7 @@ class Configuration:
SQLALCHEMY_DATABASE_URI = "sqlite:///haldis.db"
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = True
HALDIS_ADMIN_USERS = []
SECRET_KEY = "<change>"
SLACK_WEBHOOK = None
LOGFILE = "haldis.log"