From 86412a114e056445e629b97fd9318a6d89eb5c18 Mon Sep 17 00:00:00 2001
From: Luka Radenovic <luka@init.hr>
Date: Fri, 22 Oct 2021 10:37:42 +0200
Subject: [PATCH] Implemented initial communication with Kratos

---
 app.py           | 8 +++++++-
 config.py        | 1 +
 requirements.txt | 5 +++++
 run_app.sh       | 1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/app.py b/app.py
index 8654fc4b..bbf66e12 100644
--- a/app.py
+++ b/app.py
@@ -1,6 +1,7 @@
 from flask import Flask, jsonify
 from flask_jwt_extended import JWTManager
-from flask_cors import CORS, cross_origin
+from flask_cors import CORS
+import requests
 
 from config import *
 
@@ -25,3 +26,8 @@ def expired_token_callback(*args):
 @app.route('/')
 def index():
     return 'Open App Stack API v1.0'
+
+@app.route('/hello')
+def hello():
+    requests.get('{}/health/ready'.format(KRATOS_URL))
+    return 'Open App Stack API v1.0'
diff --git a/config.py b/config.py
index 5532012a..c902400e 100644
--- a/config.py
+++ b/config.py
@@ -1,3 +1,4 @@
 import os
 
 SECRET_KEY = os.environ.get('SECRET_KEY')
+KRATOS_URL = os.environ.get('KRATOS_URL')
diff --git a/requirements.txt b/requirements.txt
index ebb162e0..b4e4b89c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,14 +1,19 @@
+certifi==2021.10.8
 cffi==1.14.6
+charset-normalizer==2.0.7
 click==8.0.1
 cryptography==3.4.7
 Flask==2.0.1
 Flask-Cors==3.0.10
 Flask-JWT-Extended==4.2.3
 gunicorn==20.1.0
+idna==3.3
 itsdangerous==2.0.1
 Jinja2==3.0.1
 MarkupSafe==2.0.1
 pycparser==2.20
 PyJWT==2.1.0
+requests==2.26.0
 six==1.16.0
+urllib3==1.26.7
 Werkzeug==2.0.1
diff --git a/run_app.sh b/run_app.sh
index c025ded3..bcd86131 100755
--- a/run_app.sh
+++ b/run_app.sh
@@ -1,4 +1,5 @@
 export FLASK_APP=app.py
 export FLASK_ENV=development
 export SECRET_KEY="e38hq!@0n64g@qe6)5csk41t=ljo2vllog(%k7njnm4b@kh42c"
+export KRATOS_URL="http://127.0.0.1:8000"
 flask run
-- 
GitLab