Browse Source

Setting up for OVI db completed

PINNA FRANCESCO 1 month ago
parent
commit
fe18ac53a3

+ 1 - 1
docker-compose.yml

@@ -19,7 +19,7 @@ services:
       # Monta il volume in modalità di sola lettura (opzionale) se non vuoi che il BE modifichi i dati.
       - db_data:/usr/local/db
     ports:
-      - "5001:5000"
+      - "5001:5001"
     depends_on:
       - db
 

+ 15 - 0
flask_be/Config/config_OVI.json

@@ -0,0 +1,15 @@
+{
+    "LOCAL_ENVIRONMENT": true,
+    "DATA_CONFIG": {
+        "dbPath": "/home/fpinna/temp_for_TIGRO/temp/ovi.gat4/",
+        "dbfile_default": "ovi.db",
+        "data_interface": "sqlite3",
+        "dynamic_occ_tables": true,
+        "db_encoded": true,
+        "texts_encoded": true
+    },
+    "LOGGER_CONFIG": {
+        "filename": "Progetto2023_BE.log",
+        "level": "info"
+    }
+}

+ 3 - 3
flask_be/Config/config_loader.py

@@ -9,9 +9,9 @@ from engine.basic_queries import basicQueries
 def config(flask_app):
 
     # Get environment label, define conf file name
-    env_label = os.environ.get('APP_ENVIRONMENT')    
-    if env_label is not None and env_label!="":
-        confFileName = "config_" + env_label + ".json"
+    selected_conf_file = os.environ.get('SELECTED_CONFIG_FILE')
+    if selected_conf_file is not None and selected_conf_file!="":
+        confFileName = selected_conf_file
     # Default
     else:
         confFileName = "basic_config.json"

+ 2 - 0
flask_be/Dockerfile

@@ -2,6 +2,8 @@ FROM python:3.11.4-bullseye
 
 COPY . /usr/local/app/
 
+ENV SELECTED_CONFIG_FILE = "config_OVI.json"
+
 RUN ["pip", "install", "waitress"]
 WORKDIR /usr/local/app
 RUN ["pip", "install", "-r", "requirements.txt"]

+ 1 - 1
flask_be/app.py

@@ -93,7 +93,7 @@ def singleContext():
 
 # Start the app!
 if __name__ == '__main__':
-    app.run(port=5000)
+    app.run(port=5001)
 
 
 

+ 1 - 1
flask_be/interface_sqlite3/query_handlers.py

@@ -96,7 +96,7 @@ class queryHandlerBasicSqlite:
             return cont, self.getTextFormatting(sigla, minChar, maxChar)
 
     def getTextFormatting(self, sigla, minChar, maxChar):
-        with open(f"{self.dbPath}/ftxt/{sigla}", 'rb') as file1:
+        with open(f"{self.dbPath}ftxt/{sigla}", 'rb') as file1:
             file1.seek(minChar-1)
             formatCodes = [char for char in file1.read(maxChar-minChar)]