From e7747a306f7b846554d36f0ba9b84da63da68299 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 29 Jun 2022 18:50:57 +0200 Subject: [PATCH] Updated to cpl 2022.6 and added user info config --- .vscode/launch.json | 31 ------------------------------- .vscode/settings.json | 24 ------------------------ src/gismo/gismo.json | 5 +++-- src/gismo/startup.py | 7 ++++--- src/modules/base/base_settings.py | 2 +- 5 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index dc382e7..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python: Aktuelle Datei", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal" - }, - { - "name": "Gismo", - "type": "python", - "request": "launch", - "cwd": "${workspaceFolder}/src/gismo", - "program": "main.py", - "console": "integratedTerminal", - "args": [ - "--customer=sh-edraft.de" - ], - "env": { - "CPL_NAME": "Gismo", - "GISMO_ENVIRONMENT": "development", - "PYTHONPATH": "${workspaceFolder}/src/:$PYTHONPATH" - } - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4e78d7c..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "workbench.colorCustomizations": { - "activityBar.activeBackground": "#93e6fc", - "activityBar.activeBorder": "#fa45d4", - "activityBar.background": "#93e6fc", - "activityBar.foreground": "#15202b", - "activityBar.inactiveForeground": "#15202b99", - "activityBarBadge.background": "#fa45d4", - "activityBarBadge.foreground": "#15202b", - "sash.hoverBorder": "#93e6fc", - "statusBar.background": "#61dafb", - "statusBar.foreground": "#15202b", - "statusBarItem.hoverBackground": "#2fcefa", - "statusBarItem.remoteBackground": "#61dafb", - "statusBarItem.remoteForeground": "#15202b", - "titleBar.activeBackground": "#61dafb", - "titleBar.activeForeground": "#15202b", - "titleBar.inactiveBackground": "#61dafb99", - "titleBar.inactiveForeground": "#15202b99" - }, - "peacock.color": "#61dafb", - "python.pythonPath": "${workspaceRoot}/venv/bin/python", - "python.defaultInterpreterPath": "${workspaceRoot}/venv/bin/python", -} \ No newline at end of file diff --git a/src/gismo/gismo.json b/src/gismo/gismo.json index abc0fa8..9237a0b 100644 --- a/src/gismo/gismo.json +++ b/src/gismo/gismo.json @@ -16,10 +16,11 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "sh_cpl-core>=2021.11.0.post3", + "cpl-core>=2022.6.0", "discord.py==1.7.3", - "sh_cpl-query==2021.11.0.post3" + "cpl-query>=2022.6.0" ], + "DevDependencies": [], "PythonVersion": ">=3.9.2", "PythonPath": { "linux": "../../venv/bin/python" diff --git a/src/gismo/startup.py b/src/gismo/startup.py index 430ba58..7abbd21 100644 --- a/src/gismo/startup.py +++ b/src/gismo/startup.py @@ -4,6 +4,7 @@ from typing import Optional from cpl_core.application import StartupABC from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console from cpl_core.database import DatabaseSettings from cpl_core.dependency_injection import ServiceCollectionABC, ServiceProviderABC from cpl_core.environment import ApplicationEnvironment @@ -61,7 +62,7 @@ class Startup(StartupABC): self._config: Optional[ConfigurationABC] = None - async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: + def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: environment.set_working_directory(os.path.dirname(os.path.realpath(__file__))) configuration.add_environment_variables('GISMO_') @@ -74,8 +75,7 @@ class Startup(StartupABC): self._config = configuration return configuration - async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC: - provider: ServiceProviderABC = services.build_service_provider() + def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC: services.add_logging() services.add_db_context(DBContext, self._config.get_configuration(DatabaseSettings)) @@ -119,6 +119,7 @@ class Startup(StartupABC): startup_init_time = round((datetime.now() - datetime.strptime(self._config.get_configuration('Startup_StartTime'), '%Y-%m-%d %H:%M:%S.%f')).total_seconds(), 2) self._config.add_configuration('Startup_InitTime', str(startup_init_time)) + provider: ServiceProviderABC = services.build_service_provider() logger: LoggerABC = provider.get_service(LoggerABC) logger.debug(__name__, f'Startup Init time: {startup_init_time}s') diff --git a/src/modules/base/base_settings.py b/src/modules/base/base_settings.py index 6c76245..6e29228 100644 --- a/src/modules/base/base_settings.py +++ b/src/modules/base/base_settings.py @@ -106,5 +106,5 @@ class BaseSettings(ConfigurationModelABC): self._info_command_message.from_dict(settings['InfoCommandMessage']) self._user_info_command_message.from_dict(settings['UserInfoCommandMessage']) except Exception as e: - Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {self.__name__} settings') + Console.error(f'[ ERROR ] [ {__name__} ]: Reading error in {__name__} settings') Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')