Пример #1
0
 def initialize(self):
     logger.info('Initializing pod component')
     self.security_conf = load_yaml_config_file(
         os.path.join(self.project_root, 'conf', 'security.yml'))
     gateway_conf = load_yaml_config_file(
         os.path.join(self.project_root, 'conf', 'gateway.yml'))
     print(gateway_conf)
     master_gateway = gateway_conf['gateway']['master']
     for instance in gateway_conf['gateway']['instances']:
         if master_gateway == instance['name']:
             self.gateways['master'] = instance
         self.gateways[instance['name']] = instance
     self.ping_engine = tornado.ioloop.PeriodicCallback(
             self.ping_engine_callback, 30000)
     self.ping_engine_callback()
     logger.info('Pod component initialized')
Пример #2
0
 def initialize(self):
     logger.info('Initializing pod component')
     self.security_conf = load_yaml_config_file(
         os.path.join(self.project_root, 'conf', 'security.yml'))
     gateway_conf = load_yaml_config_file(
         os.path.join(self.project_root, 'conf', 'gateway.yml'))
     print(gateway_conf)
     master_gateway = gateway_conf['gateway']['master']
     for instance in gateway_conf['gateway']['instances']:
         if master_gateway == instance['name']:
             self.gateways['master'] = instance
         self.gateways[instance['name']] = instance
     self.ping_engine = tornado.ioloop.PeriodicCallback(
             self.ping_engine_callback, 30000)
     self.ping_engine_callback()
     logger.info('Pod component initialized')
Пример #3
0
 def initialize(self):
     config = load_yaml_config_file(os.path.join(
         self.project_root, 'conf', 'engine.yml'))
     processes = int(config['processes'])
     logger.info("Starting engine.")
     for i in range(0, processes):
         logger.info("Spawning process #%s" % i)
     logger.info("Engine started.")
Пример #4
0
 def initialize(self):
     config = load_yaml_config_file(
         os.path.join(self.project_root, 'conf', 'engine.yml'))
     processes = int(config['processes'])
     logger.info("Starting engine.")
     for i in range(0, processes):
         logger.info("Spawning process #%s" % i)
     logger.info("Engine started.")
Пример #5
0
 def __load_components(self):
     """ Loads all enabled components registered into the components
     conf.
     """
     for key, value in iteritems(firenado.conf.components):
         if value['enabled']:
             component_class = get_class_from_config(value)
             self.components[key] = component_class(key, self)
             if self.components[key].get_config_file():
                 from firenado.util.file import file_has_extension
                 filename = self.components[key].get_config_file()
                 comp_config_file = None
                 if file_has_extension(filename):
                     if os.path.isfile(
                             os.path.join(firenado.conf.APP_CONFIG_PATH,
                                          filename)):
                         comp_config_file = os.path.join(
                             firenado.conf.APP_CONFIG_PATH, filename)
                 else:
                     config_file_extensions = ['yml', 'yaml']
                     for extension in config_file_extensions:
                         candidate_filename = os.path.join(
                             firenado.conf.APP_CONFIG_PATH,
                             '%s.%s' % (filename, extension))
                         if os.path.isfile(candidate_filename):
                             comp_config_file = candidate_filename
                             break
                 if comp_config_file is not None:
                     self.components[key].conf = load_yaml_config_file(
                         comp_config_file)
                     self.components[key].process_config()
                 else:
                     logger.warn('Failed to find the file for the '
                                 'component %s at %s. Component filename '
                                 'returned is %s.' %
                                 (key, firenado.conf.APP_CONFIG_PATH,
                                  self.components[key].get_config_file()))
             self.components[key].initialize()
Пример #6
0
 def __load_components(self):
     """ Loads all enabled components registered into the components
     conf.
     """
     for key, value in iteritems(firenado.conf.components):
         if value['enabled']:
             component_class = get_class_from_config(value)
             self.components[key] = component_class(key, self)
             if self.components[key].get_config_file():
                 from firenado.util.file import file_has_extension
                 filename = self.components[key].get_config_file()
                 comp_config_file = None
                 if file_has_extension(filename):
                     if os.path.isfile(os.path.join(
                             firenado.conf.APP_CONFIG_PATH, filename)):
                         comp_config_file = os.path.join(
                             firenado.conf.APP_CONFIG_PATH, filename)
                 else:
                     config_file_extensions = ['yml', 'yaml']
                     for extension in config_file_extensions:
                         candidate_filename = os.path.join(
                                 firenado.conf.APP_CONFIG_PATH,
                                 '%s.%s' % (filename, extension))
                         if os.path.isfile(candidate_filename):
                             comp_config_file = candidate_filename
                             break
                 if comp_config_file is not None:
                     self.components[key].conf = load_yaml_config_file(
                         comp_config_file)
                     self.components[key].process_config()
                 else:
                     logger.warn('Failed to find the file for the '
                                 'component %s at %s. Component filename '
                                 'returned is %s.' % (
                                     key, firenado.conf.APP_CONFIG_PATH,
                                     self.components[key].get_config_file())
                                 )
             self.components[key].initialize()
Пример #7
0
session['file']['path'] = ''
session['handlers'] = {}
session['id_generators'] = {}
# Default session life time is 30 minutes or 1800 seconds
# If set to 0 the session will not expire
session['life_time'] = 1800
session['name'] = 'FIRENADOSESSID'
session['purge_limit'] = 500
session['redis'] = {}
session['redis']['data'] = {}
session['redis']['data']['source'] = ''
session['redis']['prefix'] = 'firenado:session'
session['type'] = ''

if HAS_LIB_CONFIG_FILE:
    lib_config = _config.load_yaml_config_file(LIB_CONFIG_FILE)
    _config.process_config(sys.modules[__name__], lib_config)

if HAS_SYS_CONFIG_FILE:
    sys_config = _config.load_yaml_config_file(SYS_CONFIG_FILE)
    _config.process_config(sys.modules[__name__], sys_config)

if HAS_APP_CONFIG_FILE:
    app_config = _config.load_yaml_config_file(APP_CONFIG_FILE)
    _config.process_app_config(sys.modules[__name__], app_config)

# Set logging basic configurations
for handler in logging.root.handlers[:]:
    # clearing loggers, solution from: https://bit.ly/2yTchyx
    logging.root.removeHandler(handler)
Пример #8
0
session['file']['path'] = ""
session['handlers'] = {}
session['id_generators'] = {}
# Default session life time is 30 minutes or 1800 seconds
# If set to 0 the session will not expire
session['life_time'] = 1800
session['name'] = "FIRENADOSESSID"
session['prefix'] = "firenado:session"
session['purge_limit'] = 500
session['redis'] = {}
session['redis']['data'] = {}
session['redis']['data']['source'] = ""
session['type'] = ""

if HAS_LIB_CONFIG_FILE:
    lib_config = _config.load_yaml_config_file(LIB_CONFIG_FILE)
    _config.process_config(sys.modules[__name__], lib_config)

if HAS_SYS_CONFIG_FILE:
    sys_config = _config.load_yaml_config_file(SYS_CONFIG_FILE)
    _config.process_config(sys.modules[__name__], sys_config)

if HAS_APP_CONFIG_FILE:
    app_config = _config.load_yaml_config_file(APP_CONFIG_FILE)
    _config.process_app_config(sys.modules[__name__], app_config)

# Set logging basic configurations
for handler in logging.root.handlers[:]:
    # clearing loggers, solution from: https://bit.ly/2yTchyx
    logging.root.removeHandler(handler)
Пример #9
0
 def initialize(self):
     self.rabbitmq['client'] = RabbitMQClient(
         load_yaml_config_file(os.path.join(
             self.project_root, 'conf', 'rabbitmq.yml')))
     self.rabbitmq['client'].connect()