@event(u'manager.config_updated')
@event(u'manager.daemon.started')
def register_web_server(manager):
 global web_server, config_hash
 if (not manager.is_daemon):
  return
 config = manager.config.get(u'web_server')
 if (get_config_hash(config) == config_hash):
  log.debug(u"web server config has'nt changed")
  return
 config_hash = get_config_hash(config)
 web_server_config = prepare_config(config)
 stop_server(manager)
 if (not web_server_config):
  return
 log.info(u'Running web server at IP %s:%s', web_server_config[u'bind'], web_server_config[u'port'])
 api_app.secret_key = get_secret()
 log.info(u'Initiating API')
 register_app(u'/api', api_app)
 if web_server_config.get(u'web_ui'):
  log.info(u'Registering WebUI')
  register_web_ui(manager)
 web_server = setup_server(web_server_config)

@ event ( u'manager.config_updated' ) @ event ( u'manager.daemon.started' ) def register_web_server ( manager ) : global web_server , config_hash if ( not manager . is_daemon ) : return config = manager . config . get ( u'web_server' ) if ( get_config_hash ( config ) == config_hash ) : log . debug ( u"web server config has'nt changed" ) return config_hash = get_config_hash ( config ) web_server_config = prepare_config ( config ) stop_server ( manager ) if ( not web_server_config ) : return log . info ( u'Running web server at IP %s:%s' , web_server_config [ u'bind' ] , web_server_config [ u'port' ] ) api_app . secret_key = get_secret ( ) log . info ( u'Initiating API' ) register_app ( u'/api' , api_app ) if web_server_config . get ( u'web_ui' ) : log . info ( u'Registering WebUI' ) register_web_ui ( manager ) web_server = setup_server ( web_server_config )
registers web server and loads api and webui via config .