def __init__(self, port=2500, db_host="localhost", db_port=6379, db_num=0, db_pw=None, flavor='lpflavor', config_id='lampost', server_interface='127.0.0.1', log_level="info", log_file=None): self.properties = {} register('json_decode', JSONDecoder().decode) register('json_encode', JSONEncoder().encode) Log(log_level, log_file) ClassRegistry() Dispatcher() RedisStore(db_host, int(db_port), int(db_num), db_pw) Permissions() SessionManager() UserManager() ConfigManager(config_id) MudNature(flavor) web_server = WebServer(int(port)) context_post_init() web_server.start_service(server_interface)
def start(args): resource.register('log', LogFactory()) scripts.select_json() # Load and activate the database configuration datastore = resource.register('datastore', RedisStore(args.db_host, args.db_port, args.db_num, args.db_pw), True) db_config = datastore.load_object(args.config_id, dbconfig.Config) config_values = config.activate(db_config.section_values) resource.register('dispatcher', event, True) resource.register('perm', permissions, True) web_server = WebServer() app_setup = import_module('{}.setup'.format(args.app_id)) app_setup.start_engine(args, config_values, web_server) resource.register('user_manager', UserManager()) resource.register('session_manager', SessionManager()) resource.register('instance_manager', InstanceManager()) resource.register('email_sender', EmailSender()) resource.register('channel_service', ChannelService()) resource.register('friend_service', FriendService()) resource.register('message_service', MessageService()) resource.register('player_list_service', PlayerListService()) resource.register('login_notify_service', AnyLoginService()) resource.register('edit_notify_service', EditUpdateService(), True) context_post_init() main_router.init(web_server) edit_router.init(web_server) web_server.add(r"/", RedirectHandler, url="/webclient/lampost.html") web_server.add(r"/webclient/(.*)", StaticFileHandler, path="webclient") web_server.start_service(args.port, args.server_interface) IOLoop.instance().start()