Updated to cpl 2022.6 and added user info config
This commit is contained in:
parent
ef276564d2
commit
8a1dfb92f8
31
.vscode/launch.json
vendored
31
.vscode/launch.json
vendored
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
24
.vscode/settings.json
vendored
24
.vscode/settings.json
vendored
@ -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",
|
|
||||||
}
|
|
@ -16,10 +16,11 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"sh_cpl-core>=2021.11.0.post3",
|
"cpl-core>=2022.6.0",
|
||||||
"discord.py==1.7.3",
|
"discord.py==1.7.3",
|
||||||
"sh_cpl-query==2021.11.0.post3"
|
"cpl-query>=2022.6.0"
|
||||||
],
|
],
|
||||||
|
"DevDependencies": [],
|
||||||
"PythonVersion": ">=3.9.2",
|
"PythonVersion": ">=3.9.2",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
"linux": "../../venv/bin/python"
|
"linux": "../../venv/bin/python"
|
||||||
|
@ -4,6 +4,7 @@ from typing import Optional
|
|||||||
|
|
||||||
from cpl_core.application import StartupABC
|
from cpl_core.application import StartupABC
|
||||||
from cpl_core.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
|
from cpl_core.console import Console
|
||||||
from cpl_core.database import DatabaseSettings
|
from cpl_core.database import DatabaseSettings
|
||||||
from cpl_core.dependency_injection import ServiceCollectionABC, ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceCollectionABC, ServiceProviderABC
|
||||||
from cpl_core.environment import ApplicationEnvironment
|
from cpl_core.environment import ApplicationEnvironment
|
||||||
@ -61,7 +62,7 @@ class Startup(StartupABC):
|
|||||||
|
|
||||||
self._config: Optional[ConfigurationABC] = None
|
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__)))
|
environment.set_working_directory(os.path.dirname(os.path.realpath(__file__)))
|
||||||
configuration.add_environment_variables('GISMO_')
|
configuration.add_environment_variables('GISMO_')
|
||||||
|
|
||||||
@ -74,8 +75,7 @@ class Startup(StartupABC):
|
|||||||
self._config = configuration
|
self._config = configuration
|
||||||
return configuration
|
return configuration
|
||||||
|
|
||||||
async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||||
provider: ServiceProviderABC = services.build_service_provider()
|
|
||||||
services.add_logging()
|
services.add_logging()
|
||||||
|
|
||||||
services.add_db_context(DBContext, self._config.get_configuration(DatabaseSettings))
|
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)
|
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))
|
self._config.add_configuration('Startup_InitTime', str(startup_init_time))
|
||||||
|
provider: ServiceProviderABC = services.build_service_provider()
|
||||||
logger: LoggerABC = provider.get_service(LoggerABC)
|
logger: LoggerABC = provider.get_service(LoggerABC)
|
||||||
logger.debug(__name__, f'Startup Init time: {startup_init_time}s')
|
logger.debug(__name__, f'Startup Init time: {startup_init_time}s')
|
||||||
|
|
||||||
|
@ -106,5 +106,5 @@ class BaseSettings(ConfigurationModelABC):
|
|||||||
self._info_command_message.from_dict(settings['InfoCommandMessage'])
|
self._info_command_message.from_dict(settings['InfoCommandMessage'])
|
||||||
self._user_info_command_message.from_dict(settings['UserInfoCommandMessage'])
|
self._user_info_command_message.from_dict(settings['UserInfoCommandMessage'])
|
||||||
except Exception as e:
|
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()}')
|
Console.error(f'[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}')
|
||||||
|
Reference in New Issue
Block a user