add condition for add user #5
@ -14,10 +14,14 @@ app.include_router(mail.router)
|
|||||||
|
|
||||||
@app.on_event("startup")
|
@app.on_event("startup")
|
||||||
async def startup_event():
|
async def startup_event():
|
||||||
if len(os.environ["USERNAME_ADMIN"]) > 0 and len(os.environ["PASSWORD_ADMIN"]) > 0:
|
if os.environ.get("USERNAME_ADMIN") is not None and os.environ.get("PASSWORD_ADMIN") is not None:
|
||||||
user_add.add(username=os.environ["USERNAME_ADMIN"], password=os.environ["PASSWORD_ADMIN"], roles="Admin")
|
user_add.add(username=os.environ["USERNAME_ADMIN"], password=os.environ["PASSWORD_ADMIN"], roles="Admin")
|
||||||
if len(os.environ["USERNAME_TEST"]) > 0 and len(os.environ["PASSWORD_TEST"]) > 0:
|
else:
|
||||||
|
print("User admin not added")
|
||||||
|
if os.environ.get("USERNAME_TEST") is not None and os.environ.get("PASSWORD_TEST") is not None:
|
||||||
user_add.add(username=os.environ["USERNAME_TEST"], password=os.environ["PASSWORD_TEST"], roles="User")
|
user_add.add(username=os.environ["USERNAME_TEST"], password=os.environ["PASSWORD_TEST"], roles="User")
|
||||||
|
else:
|
||||||
|
print("User test not added")
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
async def root():
|
async def root():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user