Development #2

Merged
NyxiumYuuki merged 2 commits from development into master 2022-01-18 18:05:32 +01:00
3 changed files with 39 additions and 23 deletions
Showing only changes of commit ad6c6fbd76 - Show all commits

View file

@ -4,4 +4,3 @@ COPY requirements.txt requirements.txt
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
COPY . . COPY . .
CMD [ "python", "-m" , "flask", "run", "--host=0.0.0.0"]

View file

@ -1,11 +1,7 @@
import os import os
import sys
sys.path.append("../application")
from application.users_model import Users from application.users_model import Users
from application.api_functions import hash_password from application.api_functions import hash_password
TAB_USER_WITH_PASSWORD = [ TAB_USER_WITH_PASSWORD = [
{ {
"id": 1, "id": 1,
@ -38,15 +34,14 @@ TAB_USER_WITH_PASSWORD = [
] ]
# Convert user with passord (uwp) to user # Convert user with passord (uwp) to user
def uwp_to_user(uwp): def uwp_to_user(uwp):
salt0 = os.urandom(32) salt0 = os.urandom(32)
hash_pass0 = hash_password(salt0, uwp["password"]) hash_pass0 = hash_password(salt0, uwp["password"])
return Users( return Users(
email = uwp["email"], email=uwp["email"],
nickname = uwp["nickname"], nickname=uwp["nickname"],
hash_pass = hash_pass0, hash_pass=hash_pass0,
salt = salt0, salt=salt0,
is_admin = uwp["is_admin"] is_admin=uwp["is_admin"]
) )

View file

@ -34,6 +34,7 @@ services:
backend: backend:
container_name: backend container_name: backend
build: ./backend build: ./backend
command: python -m flask run --host=0.0.0.0
ports: ports:
- "5000:5000" - "5000:5000"
volumes: volumes:
@ -58,14 +59,35 @@ services:
container_name: frontend container_name: frontend
build: ./frontend build: ./frontend
command: npm start command: npm start
ports:
- "4200:4200"
volumes: volumes:
- ./frontend:/data/frontend - ./frontend:/data/frontend
- ./frontend/node_modules:/data/frontend/node_modules - ./frontend/node_modules:/data/frontend/node_modules
ports:
- "4200:4200"
depends_on: depends_on:
- backend - backend
links: links:
- backend - backend
environment: environment:
- NODE_ENV=development - NODE_ENV=development
test:
container_name: test
build: ./backend
command: python test.py
volumes:
- ./backend:/data/backend
depends_on:
- flaskaled-srv1
- flaskaled-srv2
links:
- flaskaled-srv1
- flaskaled-srv2
environment:
- FLASK_APP=app.py
- FLASK_ENV=test
- FLASK_DEBUG=0
- PYTHONUNBUFFERED=1
- DATABASE_URL_USERS=postgresql://flaskaled1:aled1@flaskaled-srv1/flaskaledDb1
- DATABASE_URL_LOGS=postgresql://flaskaled2:aled2@flaskaled-srv2/flaskaledDb2
- SECRET_KEY=default_secret_key