def load_program_config(): loadedFiles = config.read([config_location]) #Create default config file if not found if len(loadedFiles) != 1: config.readfp(io.BytesIO(defaultconfig)) with open(config_location, "w") as configfile: configfile.write(defaultconfig) #check for sections for s in required_options: if s not in config.sections(): raise Exception("Config file does not contain the required section: "+s) #then check for specific options for k,v in required_options.iteritems(): for o in v: if o not in config.options(k): raise Exception("Config file does not contain the required option: "+o) try: global maker_timeout_sec maker_timeout_sec = config.getint('MESSAGING', 'maker_timeout_sec') except NoOptionError: debug('maker_timeout_sec not found in .cfg file, using default value') #configure the interface to the blockchain on startup global bc_interface bc_interface = blockchaininterface.get_blockchain_interface_instance(config)
def load_program_config(): loadedFiles = config.read([config_location]) #Create default config file if not found if len(loadedFiles) != 1: config.readfp(io.BytesIO(defaultconfig)) with open(config_location, "w") as configfile: configfile.write(defaultconfig) #check for sections for s in required_options: if s not in config.sections(): raise Exception( "Config file does not contain the required section: " + s) #then check for specific options for k, v in required_options.iteritems(): for o in v: if o not in config.options(k): raise Exception( "Config file does not contain the required option: " + o) try: global maker_timeout_sec maker_timeout_sec = config.getint('MESSAGING', 'maker_timeout_sec') except NoOptionError: debug('maker_timeout_sec not found in .cfg file, using default value') #configure the interface to the blockchain on startup global bc_interface bc_interface = blockchaininterface.get_blockchain_interface_instance( config)
def load_program_config(): loadedFiles = config.read([config_location]) #detailed sanity checking : #did the file exist? if len(loadedFiles) != 1: raise Exception("Could not find config file: "+config_location) #check for sections for s in required_options: if s not in config.sections(): raise Exception("Config file does not contain the required section: "+s) #then check for specific options for k,v in required_options.iteritems(): for o in v: if o not in config.options(k): raise Exception("Config file does not contain the required option: "+o) #configure the interface to the blockchain on startup global bc_interface bc_interface = blockchaininterface.get_blockchain_interface_instance(config)
def load_program_config(): loadedFiles = config.read([config_location]) # Create default config file if not found if len(loadedFiles) != 1: config.readfp(io.BytesIO(defaultconfig)) with open(config_location, "w") as configfile: configfile.write(defaultconfig) # check for sections for s in required_options: if s not in config.sections(): raise Exception("Config file does not contain the required section: " + s) # then check for specific options for k, v in required_options.iteritems(): for o in v: if o not in config.options(k): raise Exception("Config file does not contain the required option: " + o) # configure the interface to the blockchain on startup global bc_interface bc_interface = blockchaininterface.get_blockchain_interface_instance(config)
def load_program_config(): loadedFiles = config.read([config_location]) #Create default config file if not found if len(loadedFiles) != 1: config.readfp(io.BytesIO(defaultconfig)) with open(config_location, "w") as configfile: configfile.write(defaultconfig) #check for sections for s in required_options: if s not in config.sections(): raise Exception("Config file does not contain the required section: "+s) #then check for specific options for k,v in required_options.iteritems(): for o in v: if o not in config.options(k): raise Exception("Config file does not contain the required option: "+o) #configure the interface to the blockchain on startup global bc_interface bc_interface = blockchaininterface.get_blockchain_interface_instance(config)