internal 1.0.48__tar.gz → 1.0.50__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of internal might be problematic. Click here for more details.
- {internal-1.0.48 → internal-1.0.50}/PKG-INFO +1 -1
- {internal-1.0.48 → internal-1.0.50}/pyproject.toml +1 -1
- {internal-1.0.48 → internal-1.0.50}/src/internal/base_factory.py +4 -8
- {internal-1.0.48 → internal-1.0.50}/src/internal/database.py +8 -2
- {internal-1.0.48 → internal-1.0.50}/README.md +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/base_config.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/contact_type.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/description_type.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/event_trigger_type.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/lpnr_direction.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/operator_type.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/common_enum/order_type.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/const.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/exception/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/exception/base_exception.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/exception/internal_exception.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/ext/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/ext/amazon/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/ext/amazon/aws/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/ext/amazon/aws/const.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/http/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/http/requests.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/http/responses.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/interface/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/interface/base_interface.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/middleware/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/middleware/log_request.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/model/__init__.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/model/base_model.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/model/operate.py +0 -0
- {internal-1.0.48 → internal-1.0.50}/src/internal/utils.py +0 -0
|
@@ -62,6 +62,7 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
62
62
|
|
|
63
63
|
@asynccontextmanager
|
|
64
64
|
async def lifespan(app: FastAPI):
|
|
65
|
+
# code to execute when app is loading
|
|
65
66
|
await mongodb.connect()
|
|
66
67
|
document_model_list = await self.get_document_model_list()
|
|
67
68
|
await init_beanie(database=app.state.db.get_database(), document_models=document_model_list)
|
|
@@ -70,10 +71,13 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
70
71
|
app.state.logger.info("Initialization state cache done")
|
|
71
72
|
await self.init_state_scheduler_app(app, self.get_app_config())
|
|
72
73
|
app.state.logger.info("Initialization state scheduler app done")
|
|
74
|
+
|
|
73
75
|
yield
|
|
76
|
+
# code to execute when app is shutting down
|
|
74
77
|
await mongodb.close()
|
|
75
78
|
app.state.logger.info("Database disconnected")
|
|
76
79
|
|
|
80
|
+
|
|
77
81
|
if title is None:
|
|
78
82
|
title = self.DEFAULT_APP_NAME
|
|
79
83
|
|
|
@@ -113,14 +117,6 @@ class BaseFactory(metaclass=ABCMeta):
|
|
|
113
117
|
self.get_app_config().DATABASE_AUTH_SOURCE,
|
|
114
118
|
self.get_app_config().DATABASE_SSL, self.get_app_config().DATABASE_SSL_CA_CERTS)
|
|
115
119
|
|
|
116
|
-
@app.on_event("startup")
|
|
117
|
-
async def startup_db_client():
|
|
118
|
-
print("startup_db_client================run")
|
|
119
|
-
|
|
120
|
-
@app.on_event("shutdown")
|
|
121
|
-
async def shutdown_db_client():
|
|
122
|
-
print("shutdown_db_client============run")
|
|
123
|
-
|
|
124
120
|
app.state.db = mongodb
|
|
125
121
|
app.state.config = self.get_app_config()
|
|
126
122
|
self.__init_modules(app)
|
|
@@ -44,8 +44,14 @@ class MongoDB:
|
|
|
44
44
|
raise DatabaseConnectFailureException()
|
|
45
45
|
return self.client[self.db_name]
|
|
46
46
|
|
|
47
|
-
def get_mongodb_uri(self) -> str:
|
|
48
|
-
|
|
47
|
+
async def get_mongodb_uri(self) -> str:
|
|
48
|
+
if self.user_name and self.password:
|
|
49
|
+
uri = f"mongodb://{self.user_name}:{self.password}@{self.host}:{self.port}/{self.db_name}"
|
|
50
|
+
else:
|
|
51
|
+
uri = f"mongodb://{self.host}:{self.port}/{self.db_name}"
|
|
52
|
+
|
|
53
|
+
uri += f"?authSource={self.auth_source}&connectTimeoutMS={self.connection_timeout}&serverSelectionTimeoutMS={self.server_selection_timeout}&retryWrites=false"
|
|
54
|
+
|
|
49
55
|
if self.ssl:
|
|
50
56
|
uri += "&ssl=true"
|
|
51
57
|
if self.ssl_ca_certs and self.ssl_ca_certs != "":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|