-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
45 lines (36 loc) · 1.11 KB
/
Copy path__init__.py
File metadata and controls
45 lines (36 loc) · 1.11 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from webfluid import Additive, Fluid
from webfluid.core.ext import scheduler, babel
from webfluid.core.constants import EXT_BABEL
from apscheduler.triggers.cron import CronTrigger
additive = Additive(
__name__,
required_extensions=[
"scheduling",
"sqlalchemy",
"security",
"events",
"cache",
"jwt"
]
)
@additive.before_enable
async def before_enable(fluid: Fluid):
fluid.add_source(
f'<script src="{additive.prefix}/static/js/utils.js" type="module"></script>',
priority=5
)
from .api import health, setup_v1
additive.api.get("/health")(health)
setup_v1(additive, fluid)
from .events import setup as setup_events
setup_events(additive)
bind = fluid.config.get("SECURITY_MODELS_DB_BIND")
if bind:
from .models.token import Token
Token.set_bind(bind)
from .jobs import get_watcher, cache_revoked
scheduler.add_job(get_watcher(fluid), CronTrigger(hour=0))
await cache_revoked()
if EXT_BABEL:
from .i18n import translations
babel.update_translations("messages", translations)