Merge pull request 'backoffice' (#4) from backoffice into master

Reviewed-on: #4
This commit is contained in:
v4l3n71n 2023-10-17 19:40:12 +00:00
commit e658ccba8b
2 changed files with 15 additions and 2 deletions

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM python:3.11.6-alpine3.18
WORKDIR /app
COPY requierements.txt /app/
COPY app /app/app
RUN pip install --upgrade pip && pip install -r requierements.txt
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -12,8 +12,10 @@ app.include_router(mail.router)
@app.on_event("startup") @app.on_event("startup")
async def startup_event(): async def startup_event():
user_add.add(username="Peter93", password="toto", roles="Admin") if len(os.environ["USERNAME_ADMIN"]) > 0 and len(os.environ["PASSWORD_ADMIN"]) > 0:
user_add.add(username="Robert80", password="titi", roles="User") 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:
user_add.add(username=os.environ["USERNAME_TEST"], password=os.environ["PASSWORD_TEST"], roles="User")
@app.get("/") @app.get("/")
async def root(): async def root():