mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2024-12-22 01:40:12 +00:00
simplify reading json files
This commit is contained in:
parent
00e9e4bc53
commit
87b72a571d
@ -399,8 +399,7 @@ class ElasticBackup:
|
|||||||
def get_mapping():
|
def get_mapping():
|
||||||
"""read index_mapping.json and get expected mapping and settings"""
|
"""read index_mapping.json and get expected mapping and settings"""
|
||||||
with open("home/src/es/index_mapping.json", "r", encoding="utf-8") as f:
|
with open("home/src/es/index_mapping.json", "r", encoding="utf-8") as f:
|
||||||
config_str = f.read()
|
index_config = json.load(f).get("index_config")
|
||||||
index_config = json.loads(config_str).get("index_config")
|
|
||||||
|
|
||||||
return index_config
|
return index_config
|
||||||
|
|
||||||
|
@ -38,8 +38,7 @@ class AppConfig:
|
|||||||
def get_config_file(self):
|
def get_config_file(self):
|
||||||
"""read the defaults from config.json"""
|
"""read the defaults from config.json"""
|
||||||
with open("home/config.json", "r", encoding="utf-8") as f:
|
with open("home/config.json", "r", encoding="utf-8") as f:
|
||||||
config_str = f.read()
|
config_file = json.load(f)
|
||||||
config_file = json.loads(config_str)
|
|
||||||
|
|
||||||
config_file["application"].update(self.get_config_env())
|
config_file["application"].update(self.get_config_env())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user