isayahc commited on
Commit
3663db2
1 Parent(s): 8d4f64c

switch config from ini to env

Browse files
innovation_pathfinder_ai/database/db_handler.py CHANGED
@@ -2,12 +2,13 @@ from sqlmodel import SQLModel, create_engine, Session, select
2
  from innovation_pathfinder_ai.database.schema import Sources
3
  from innovation_pathfinder_ai.utils.logger import get_console_logger
4
  from configparser import ConfigParser
5
- # from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
 
6
 
7
- config = ConfigParser()
8
- config.read('innovation_pathfinder_ai/config.ini')
 
9
 
10
- sqlite_file_name = config.get('main', 'SOURCES_CACHE')
11
  sqlite_url = f"sqlite:///{sqlite_file_name}"
12
  engine = create_engine(sqlite_url, echo=False)
13
 
 
2
  from innovation_pathfinder_ai.database.schema import Sources
3
  from innovation_pathfinder_ai.utils.logger import get_console_logger
4
  from configparser import ConfigParser
5
+ import os
6
+ from dotenv import load_dotenv
7
 
8
+ load_dotenv()
9
+
10
+ sqlite_file_name = os.getenv('SOURCES_CACHE')
11
 
 
12
  sqlite_url = f"sqlite:///{sqlite_file_name}"
13
  engine = create_engine(sqlite_url, echo=False)
14