Use the same DB for Axione and Arcep data

This commit is contained in:
Félix Baylac-Jacqué 2022-04-15 10:35:33 +02:00
parent a39d004ec3
commit d5616ec027
2 changed files with 5 additions and 8 deletions

View file

@ -1,5 +1,4 @@
[DB]
axione_ipe_path = /path/to/ipe.sqlite
path = /path/to/ipe.sqlite
axione_ipe_db_name = ipe
arcep_ipe_path = /path/to/ipe.sqlite
arcep_ipe_db_name = arcep

View file

@ -6,9 +6,8 @@ import sqlite3
import os
from ipe_fetcher import Liazo,Axione,Arcep,AreaCoordinates
class Config(TypedDict):
axione_ipe_path: str
db_path: str
axione_ipe_db_name: str
arcep_ipe_path: str
arcep_ipe_db_name: str
@ -18,9 +17,8 @@ def parseConfig() -> Config:
with open(cfg_path, "r") as f:
cfg.read_file(f)
return {
"axione_ipe_path": cfg.get("DB", "axione_ipe_path"),
"db_path": cfg.get("DB", "path"),
"axione_ipe_db_name": cfg.get("DB", "axione_ipe_db_name"),
"arcep_ipe_path": cfg.get("DB", "arcep_ipe_path"),
"arcep_ipe_db_name": cfg.get("DB", "arcep_ipe_db_name"),
}
@ -28,8 +26,8 @@ def parseConfig() -> Config:
app = Flask(__name__)
cfg: Config = parseConfig()
axione = Axione(cfg.get("axione_ipe_path"), cfg.get("axione_ipe_db_name"))
arcep = Arcep(cfg.get("arcep_ipe_path"), cfg.get("arcep_ipe_db_name"))
axione = Axione(cfg.get("db_path"), cfg.get("axione_ipe_db_name"))
arcep = Arcep(cfg.get("db_path"), cfg.get("arcep_ipe_db_name"))
liazo = Liazo()