Path: blob/master/src/config/Config.py
296 views
import json1import os23def getServerConfig():4with open('../config/server.json', 'r') as server:5jsonServerData = json.load(server)6return jsonServerData78def getSystemConfig():9with open('../config/system.json', 'r') as system:10jsonSystemData = json.load(system)11return jsonSystemData1213def getBrokerAppConfig():14with open('../config/brokerapp.json', 'r') as brokerapp:15jsonUserData = json.load(brokerapp)16return jsonUserData1718def getHolidays():19with open('../config/holidays.json', 'r') as holidays:20holidaysData = json.load(holidays)21return holidaysData2223def getTimestampsData():24serverConfig = getServerConfig()25timestampsFilePath = os.path.join(serverConfig['deployDir'], 'timestamps.json')26if os.path.exists(timestampsFilePath) == False:27return {}28timestampsFile = open(timestampsFilePath, 'r')29timestamps = json.loads(timestampsFile.read())30return timestamps3132def saveTimestampsData(timestamps = {}):33serverConfig = getServerConfig()34timestampsFilePath = os.path.join(serverConfig['deployDir'], 'timestamps.json')35with open(timestampsFilePath, 'w') as timestampsFile:36json.dump(timestamps, timestampsFile, indent=2)37print("saved timestamps data to file " + timestampsFilePath)383940