def load_config(config_file): """ Validates the given file for use as the settings file for BGPSpeaker and loads the configuration from the given file as a module instance. """ if not config_file or not os.path.isfile(config_file): raise ApplicationException(desc='Invalid configuration file: %s' % config_file) # Loads the configuration from the given file, if available. try: return load_source('bgpspeaker.application.settings', config_file) except Exception as e: raise ApplicationException(desc=str(e))
def load_config(config_file): """ Validates the given file for use as the settings file for BGPSpeaker and loads the configuration from the given file as a module instance. """ if not config_file or not os.path.isfile(config_file): raise ApplicationException( desc='Invalid configuration file: %s' % config_file) # Loads the configuration from the given file, if available. try: return load_source('bgpspeaker.application.settings', config_file) except Exception as e: raise ApplicationException(desc=str(e))