4
4
5
5
from ellar .common import IModuleSetup , Module
6
6
from ellar .core import Config , ModuleSetup
7
- from ellar .core .modules import DynamicModule , ModuleBase
7
+ from ellar .core .modules import DynamicModule , ModuleBase , ModuleRefBase
8
8
from ellar .di import ProviderConfig
9
9
from pydantic import AnyHttpUrl
10
10
11
11
from .schemas import JWTConfiguration
12
12
from .services import JWTService
13
13
14
14
15
- @Module ()
15
+ @Module (exports = [ JWTService , JWTConfiguration ] )
16
16
class JWTModule (ModuleBase , IModuleSetup ):
17
17
@classmethod
18
18
def setup (
@@ -43,7 +43,7 @@ def setup(
43
43
return DynamicModule (
44
44
cls ,
45
45
providers = [
46
- JWTService ,
46
+ ProviderConfig ( JWTService ) ,
47
47
ProviderConfig (JWTConfiguration , use_value = configuration ),
48
48
],
49
49
)
@@ -54,14 +54,14 @@ def register_setup(cls) -> ModuleSetup:
54
54
55
55
@staticmethod
56
56
def register_setup_factory (
57
- module : t . Type [ "JWTModule" ] , config : Config
57
+ module_ref : ModuleRefBase , config : Config
58
58
) -> DynamicModule :
59
59
if config .get ("JWT_CONFIG" ) and isinstance (config .JWT_CONFIG , dict ):
60
60
schema = JWTConfiguration (** dict (config .JWT_CONFIG ))
61
61
return DynamicModule (
62
- module ,
62
+ module_ref . module ,
63
63
providers = [
64
- JWTService ,
64
+ ProviderConfig ( JWTService ) ,
65
65
ProviderConfig (JWTConfiguration , use_value = schema ),
66
66
],
67
67
)
0 commit comments