File tree 3 files changed +17
-7
lines changed
3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 26
26
""" )
27
27
28
28
from .app import create_app # noqa isort:skip
29
- app = create_app ()
Original file line number Diff line number Diff line change 1
1
import sys
2
2
from datetime import datetime , timedelta
3
+ from typing import Any , Dict
3
4
4
5
import click
5
- from flask import current_app
6
+ from flask import Flask , current_app
6
7
from flask .cli import FlaskGroup , with_appcontext
7
8
9
+ from alerta .app import config , db , qb
8
10
from alerta .auth .utils import generate_password_hash
9
11
from alerta .models .enums import Scope
10
12
from alerta .models .key import ApiKey
13
15
from alerta .version import __version__
14
16
15
17
16
- def _create_app (info ):
17
- from alerta .app import create_app
18
- return create_app ()
18
+ def create_app (config_override : Dict [str , Any ] = None , environment : str = None ) -> Flask :
19
+ app = Flask (__name__ )
20
+ app .config ['ENVIRONMENT' ] = environment
21
+ config .init_app (app )
22
+ app .config .update (config_override or {})
19
23
24
+ db .init_db (app )
25
+ qb .init_app (app )
20
26
21
- @click .group (cls = FlaskGroup , create_app = _create_app , add_version_option = False )
27
+ return app
28
+
29
+
30
+ @click .group (cls = FlaskGroup , create_app = create_app , add_version_option = False )
22
31
@click .version_option (version = __version__ )
23
32
def cli ():
24
33
"""
Original file line number Diff line number Diff line change 1
- from alerta import app # noqa: F401
1
+ from alerta import create_app
2
+
3
+ app = create_app ()
You can’t perform that action at this time.
0 commit comments