diff --git a/.gitignore b/.gitignore index c9ebf66d..5bda03c6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ __pycache__/ *.so *.xml +/certs + # Distribution / packaging .Python env/ diff --git a/app/__init__.py b/app/__init__.py index 4fc4a338..49e94796 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -85,8 +85,17 @@ def get_locale(): 'de': 'German' } +client_key_path = "/tmp/client-key.pem" + +with open(client_key_path, "w") as key_file: + key_file.write(os.environ["SSL_KEY"]) + +ssl_args = { + "ssl_key": client_key_path, +} + # Initiate database -db = SQLAlchemy(app, engine_options={"pool_pre_ping": True}) +db = SQLAlchemy(app, engine_options={"connect_args": ssl_args, "pool_pre_ping": True}) migrate = Migrate(app, db, directory=MIGRATION_DIR) diff --git a/app/config.py b/app/config.py index fec26b98..bf9437bf 100644 --- a/app/config.py +++ b/app/config.py @@ -3,7 +3,7 @@ TESTING = True DEBUG = True FLASK_DEBUG = True -SQLALCHEMY_DATABASE_URI = 'mysql://root:NwwQb14QsGcnASCviwMSEcJCrSdqOcCj@cnqvnz.stackhero-network.com:7930/root?useSSL=true&requireSSL=true' +SQLALCHEMY_DATABASE_URI = 'mysql://root:NwwQb14QsGcnASCviwMSEcJCrSdqOcCj@cnqvnz.stackhero-network.com:7930/root' MAIL_USERNAME = 'carculator@psi.ch' MAIL_PASSWORD = 'xxxxxxxx' MAIL_SERVER = 'smtp.gmail.com' diff --git a/requirements.txt b/requirements.txt index f1ef7a3c..cfc1744c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,4 +31,4 @@ mysqlclient gunicorn pyyaml werkzeug<3.0 -netCDF4 \ No newline at end of file +netCDF4