From f67c0d2e23e43b92d116fc95c45037edca526c00 Mon Sep 17 00:00:00 2001
From: Evans Ochola Ochieng <eo00684@surrey.ac.uk>
Date: Wed, 29 Mar 2023 17:07:43 +0100
Subject: [PATCH] Add config file

---
 post-service/config.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 post-service/config.py

diff --git a/post-service/config.py b/post-service/config.py
new file mode 100644
index 0000000..57b18ea
--- /dev/null
+++ b/post-service/config.py
@@ -0,0 +1,25 @@
+import os
+from dotenv import load_dotenv
+
+dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
+if os.path.exists(dotenv_path):
+    load_dotenv(dotenv_path)
+
+
+class Config:
+
+    SQLALCHEMY_TRACK_MODIFICATONS = False
+
+
+class DevelopmentConfig(Config):
+    ENV = "development"
+    DEBUG = True
+    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://post-service:pass1234@host.docker.internal:3306/post_dev'
+    SQLALCHEMY_ECHO = True
+
+
+class ProductionConfig(Config):
+    ENV = "production"
+    DEBUG = True
+    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://post-service:pass1234@db:3306/post'
+    SQLALCHEMY_ECHO = False
-- 
GitLab