diff --git a/.gitignore b/.gitignore index 2baeb34..b331f09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ gitea/ .env pmb-pf/ +backend/giapp.py diff --git a/backend/Dockerfile b/backend/Dockerfile index 6e581ef..fc602f1 100755 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -8,7 +8,7 @@ RUN target=/root/.cache/pip \ COPY . . -ENV FLASK_APP app.py +ENV FLASK_APP giapp.py # This might be scary to leave on #ENV FLASK_ENV development diff --git a/backend/app.py b/backend/app.py index cbd8846..8705f70 100755 --- a/backend/app.py +++ b/backend/app.py @@ -1,6 +1,6 @@ import os from datetime import datetime -from flask import Flask +from flask import Flask, request import mysql.connector @@ -46,6 +46,10 @@ def listBlog(): rec = conn.query_titles() response = '' + ict = '' + arg1 = '' + arg2 = '' + for c in rec: response = response + '
Log: ' + c + '
' @@ -54,6 +58,28 @@ def listBlog(): response = response + '
Delta: ' + dtFormatted + '
' return response +@server.route('/args-test', methods=['GET']) +def listArgs(): + + good_token_i = str(os.getenv("TOKEN_I")) + ict = str(request.args.get('ict')) + arg1 = str(request.args.get('arg1')) + arg2 = str(request.args.get('arg2')) + + response = '' + + #INSECURE DEBUG response = response + '
gt:' + good_token_i + 'it:' + ict + '
' + + if request.args.get('ict') == good_token_i: + response = response + '
Success
' + response = response + '
arg1' + arg1 + '
' + response = response + '
arg2' + arg2 + '
' + + dt = datetime.now() + dtFormatted = dt.strftime("%Y-%m-%d %H:%M") + response = response + '
Delta: ' + dtFormatted + '
' + return response + if __name__ == '__main__': server.run() diff --git a/compose.yaml b/compose.yaml index 67a98cf..5ee2e1e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -31,6 +31,8 @@ services: - MYSQL_USER=flasku #- MYSQL_PASSWORD=flaskp - MYSQL_PASSWORD=${DOTENV_MYSQL_FLASK_PASSWORD} + - TOKEN_I=${DOTENV_TOKEN_I} + - TOKEN_C=${DOTENV_TOKEN_C} #ports: # - 8000:8000 expose: @@ -94,11 +96,12 @@ services: - frontnet pmb: - build: - args: - GPG_PP: $BUILD_GPG_PP - context: pmb-pf - dockerfile: Dockerfile + #build: + # args: + # GPG_PP: $BUILD_GPG_PP + # context: pmb-pf + # dockerfile: Dockerfile + image: site_pmb:latest expose: - "25" env_file: diff --git a/dotenv b/dotenv index c08b297..d5122f5 100644 --- a/dotenv +++ b/dotenv @@ -1,7 +1,20 @@ -DOTENV_MYSQL_ROOT_PASSWORD_OLD=rootpass -DOTENV_MYSQL_ROOT_PASSWORD=rootpass +# Example .env file +DOTENV_MYSQL_ROOT_PASSWORD_OLD=rootp +DOTENV_MYSQL_ROOT_PASSWORD=rootp DOTENV_MYSQL_GITEA_PASSWORD=giteap DOTENV_MYSQL_FLASK_PASSWORD=flaskp +GITEA_MAIL_FROM= +# Build ARG GPG_PP. May still need to be empty to avoid breakage. +BUILD_GPG_PP= + + +# Backend: + +# Inconsequential token: minimal inconvenience if exposed +DOTENV_TOKEN_I=dti + +# Consequential token: protect +DOTENV_TOKEN_C=dtc