def __init__(self): self.path = os.sep.join(os.path.abspath(__file__).split( os.sep)[:-1]) # The path to the package dir self.version = __version__ self.static_config = load_config( os.path.join(".", 'config', "config.yaml")) self.database_file = os.path.join(".", 'config', "craftbeerpi.db") logger.info("Init CraftBeerPI") policy = auth.SessionTktAuthentication(urandom(32), 60, include_ip=True) middlewares = [ web.normalize_path_middleware(), session_middleware(EncryptedCookieStorage(urandom(32))), auth.auth_middleware(policy), error_middleware ] self.app = web.Application(middlewares=middlewares) self.app["cbpi"] = self self._setup_shutdownhook() self.initializer = [] self.bus = CBPiEventBus(self.app.loop, self) self.job = JobController(self) self.config = ConfigController(self) self.ws = CBPiWebSocket(self) self.actor = ActorController(self) self.sensor = SensorController(self) self.plugin = PluginController(self) self.log = LogController(self) self.system = SystemController(self) self.kettle = KettleController(self) self.step: StepController = StepController(self) self.recipe: RecipeController = RecipeController(self) self.notification: NotificationController = NotificationController( self) self.satellite = None if self.static_config.get("mqtt", False) is True: self.satellite: SatelliteController = SatelliteController(self) self.dashboard = DashboardController(self) self.http_step = StepHttpEndpoints(self) self.http_recipe = RecipeHttpEndpoints(self) self.http_sensor = SensorHttpEndpoints(self) self.http_config = ConfigHttpEndpoints(self) self.http_actor = ActorHttpEndpoints(self) self.http_kettle = KettleHttpEndpoints(self) self.http_dashboard = DashBoardHttpEndpoints(self) self.http_plugin = PluginHttpEndpoints(self) self.http_system = SystemHttpEndpoints(self) self.http_log = LogHttpEndpoints(self) self.http_notification = NotificationHttpEndpoints(self) self.login = Login(self)
def __init__(self): self.version = "4.0.0.1" self.static_config = load_config("./config/config.yaml") self.database_file = "./craftbeerpi.db" logger.info("Init CraftBeerPI") policy = auth.SessionTktAuthentication(urandom(32), 60, include_ip=True) middlewares = [ web.normalize_path_middleware(), session_middleware(EncryptedCookieStorage(urandom(32))), auth.auth_middleware(policy), error_middleware ] self.app = web.Application(middlewares=middlewares) self.app["cbpi"] = self self._setup_shutdownhook() self.initializer = [] self.bus = CBPiEventBus(self.app.loop, self) self.job = JobController(self) self.config = ConfigController(self) self.ws = CBPiWebSocket(self) self.translation = TranslationController(self) self.actor = ActorController(self) self.sensor = SensorController(self) self.plugin = PluginController(self) self.log = LogController(self) self.system = SystemController(self) self.kettle = KettleController(self) self.step = StepController(self) self.dashboard = DashboardController(self) self.http_step = StepHttpEndpoints(self) self.http_sensor = SensorHttpEndpoints(self) self.http_config = ConfigHttpEndpoints(self) self.http_actor = ActorHttpEndpoints(self) self.http_kettle = KettleHttpEndpoints(self) self.http_dashboard = DashBoardHttpEndpoints(self) self.http_translation = TranslationHttpEndpoint(self) self.http_plugin = PluginHttpEndpoints(self) self.http_system = SystemHttpEndpoints(self) self.notification = NotificationController(self) self.http_log = LogHttpEndpoints(self) self.login = Login(self)
def __init__(self, configFolder): operationsystem= sys.platform if operationsystem.startswith('win'): set_event_loop_policy(WindowsSelectorEventLoopPolicy()) self.path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-1]) # The path to the package dir self.version = __version__ self.codename = __codename__ self.config_folder = configFolder self.static_config = load_config(configFolder.get_file_path("config.yaml")) logger.info("Init CraftBeerPI") policy = auth.SessionTktAuthentication(urandom(32), 60, include_ip=True) middlewares = [web.normalize_path_middleware(), session_middleware(EncryptedCookieStorage(urandom(32))), auth.auth_middleware(policy), error_middleware] # max upload size increased to 5 Mb. Default is 1 Mb -> config and svg upload self.app = web.Application(middlewares=middlewares, client_max_size=5*1024*1024) self.app["cbpi"] = self self._setup_shutdownhook() self.initializer = [] self.bus = CBPiEventBus(self.app.loop, self) self.job = JobController(self) self.config = ConfigController(self) self.ws = CBPiWebSocket(self) self.actor = ActorController(self) self.sensor = SensorController(self) self.plugin = PluginController(self) self.log = LogController(self) self.system = SystemController(self) self.kettle = KettleController(self) self.fermenter : FermentationController = FermentationController(self) self.step : StepController = StepController(self) self.recipe : RecipeController = RecipeController(self) self.fermenterrecipe : FermenterRecipeController = FermenterRecipeController(self) self.upload : UploadController = UploadController(self) self.notification : NotificationController = NotificationController(self) self.satellite = None if str(self.static_config.get("mqtt", False)).lower() == "true": self.satellite: SatelliteController = SatelliteController(self) self.dashboard = DashboardController(self) self.http_step = StepHttpEndpoints(self) self.http_recipe = RecipeHttpEndpoints(self) self.http_fermenterrecipe = FermenterRecipeHttpEndpoints(self) self.http_sensor = SensorHttpEndpoints(self) self.http_config = ConfigHttpEndpoints(self) self.http_actor = ActorHttpEndpoints(self) self.http_kettle = KettleHttpEndpoints(self) self.http_dashboard = DashBoardHttpEndpoints(self) self.http_plugin = PluginHttpEndpoints(self) self.http_system = SystemHttpEndpoints(self) self.http_log = LogHttpEndpoints(self) self.http_notification = NotificationHttpEndpoints(self) self.http_upload = UploadHttpEndpoints(self) self.http_fermenter = FermentationHttpEndpoints(self) self.login = Login(self)