aboutsummaryrefslogtreecommitdiff
path: root/services/manager/service/_app.py
blob: 23043409579c95da0dc3cd0992782679af76c047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from ._base import (
    AppBase,
    CommandDispatcher,
    PathCommandProvider,
)
from ._template import TemplateManager
from ._nginx import NginxManager
from ._external import CliToolCommandProvider

APP_ID = "crupest"


class App(AppBase):
    def __init__(self):
        super().__init__(APP_ID, f"{APP_ID}-service")
        self.add_feature(PathCommandProvider())
        self.add_feature(TemplateManager())
        self.add_feature(NginxManager())
        self.add_feature(CliToolCommandProvider())
        self.add_feature(CommandDispatcher())

    def run_command(self):
        command_dispatcher = self.get_feature(CommandDispatcher)
        command_dispatcher.run_command()


def create_app() -> App:
    app = App()
    app.setup()
    return app