Merge pull request 'Updated packages #297_cpl_update' (#320) from #297_cpl_update into 1.1.0
Reviewed-on: sh-edraft.de/kd_discord_bot#320 Reviewed-by: Ebola-Chan <nick.jungmann@gmail.com>
This commit is contained in:
commit
c1ec7dd97b
@ -16,23 +16,23 @@
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core==2022.12.1.post3",
|
||||
"cpl-translation==2022.12.1",
|
||||
"cpl-query==2022.12.2.post2",
|
||||
"cpl-discord==2022.12.2.post1",
|
||||
"Flask==2.2.2",
|
||||
"cpl-core==2023.4.0.post2",
|
||||
"cpl-translation==2023.4.0.post1",
|
||||
"cpl-query==2023.4.0.post1",
|
||||
"cpl-discord==2023.4.0.post3",
|
||||
"Flask==2.3.2",
|
||||
"Flask-Classful==0.14.2",
|
||||
"Flask-Cors==3.0.10",
|
||||
"PyJWT==2.6.0",
|
||||
"PyJWT==2.7.0",
|
||||
"waitress==2.1.2",
|
||||
"Flask-SocketIO==5.3.2",
|
||||
"Flask-SocketIO==5.3.4",
|
||||
"eventlet==0.33.3",
|
||||
"requests-oauthlib==1.3.1",
|
||||
"icmplib==3.0.3",
|
||||
"ariadne==0.17.1"
|
||||
"ariadne==0.19.1"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli==2022.12.1.post3",
|
||||
"cpl-cli==2023.4.0.post3",
|
||||
"pygount==1.5.1"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 0c9463753731ab1f5d0f916d21ac7ea304742995
|
||||
Subproject commit e1c1efac984a04826c0c2713a26129b9d34b21d6
|
@ -1,5 +1,5 @@
|
||||
from ariadne import graphql_sync
|
||||
from ariadne.constants import PLAYGROUND_HTML
|
||||
from ariadne.explorer import ExplorerGraphiQL
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from flask import request, jsonify
|
||||
@ -30,7 +30,7 @@ class GraphQLController:
|
||||
if self._env.environment_name != "development":
|
||||
return "", 403
|
||||
|
||||
return PLAYGROUND_HTML, 200
|
||||
return ExplorerGraphiQL().html(None), 200
|
||||
|
||||
@Route.post(f"{BasePath}")
|
||||
@Route.authorize(by_api_key=True)
|
||||
|
@ -1,32 +1,26 @@
|
||||
import traceback
|
||||
|
||||
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
from cpl_core.console import Console, ForegroundColorEnum
|
||||
from cpl_core.utils.json_processor import JSONProcessor
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_core.configuration.file_logging_settings import FileLoggingSettings
|
||||
|
||||
|
||||
class BotLoggingSettings(ConfigurationModelABC):
|
||||
def __init__(self):
|
||||
def __init__(self, custom_logs: dict = None):
|
||||
ConfigurationModelABC.__init__(self)
|
||||
self._files: List[FileLoggingSettings] = List(FileLoggingSettings)
|
||||
|
||||
if custom_logs is not None:
|
||||
self._files_from_dict(custom_logs)
|
||||
|
||||
@property
|
||||
def files(self) -> List[FileLoggingSettings]:
|
||||
return self._files
|
||||
|
||||
def from_dict(self, settings: dict):
|
||||
try:
|
||||
files = List(FileLoggingSettings)
|
||||
for s in settings:
|
||||
st = FileLoggingSettings()
|
||||
settings[s]["Key"] = s
|
||||
st.from_dict(settings[s])
|
||||
files.append(st)
|
||||
self._files = files
|
||||
except Exception as e:
|
||||
Console.set_foreground_color(ForegroundColorEnum.red)
|
||||
Console.write_line(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
|
||||
Console.write_line(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
|
||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||
def _files_from_dict(self, settings: dict):
|
||||
files = List(FileLoggingSettings)
|
||||
for s in settings:
|
||||
settings[s]["Key"] = s
|
||||
st = JSONProcessor.process(FileLoggingSettings, settings[s])
|
||||
files.append(st)
|
||||
self._files = files
|
||||
|
@ -1,23 +1,27 @@
|
||||
import traceback
|
||||
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.logging import LoggingSettings
|
||||
from cpl_core.logging import LoggingSettings, LoggingLevelEnum
|
||||
|
||||
|
||||
class FileLoggingSettings(LoggingSettings):
|
||||
def __init__(self):
|
||||
LoggingSettings.__init__(self)
|
||||
def __init__(
|
||||
self,
|
||||
key: str,
|
||||
path: str = None,
|
||||
filename: str = None,
|
||||
console_log_level: LoggingLevelEnum = None,
|
||||
file_log_level: LoggingLevelEnum = None,
|
||||
):
|
||||
LoggingSettings.__init__(self, path, filename, console_log_level, file_log_level)
|
||||
|
||||
self._key = ""
|
||||
self._key = key
|
||||
|
||||
@property
|
||||
def key(self) -> str:
|
||||
return self._key
|
||||
|
||||
def from_dict(self, settings: dict):
|
||||
try:
|
||||
self._key = settings["Key"]
|
||||
super().from_dict(settings)
|
||||
except Exception as e:
|
||||
Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
|
||||
Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
|
||||
# def from_dict(self, settings: dict):
|
||||
# try:
|
||||
# self._key = settings["Key"]
|
||||
# super().from_dict(settings)
|
||||
# except Exception as e:
|
||||
# Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
|
||||
# Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
|
||||
|
@ -16,10 +16,10 @@
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core>=1.0.7"
|
||||
"cpl-core==2022.12.0"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli>=1.0.7"
|
||||
"cpl-core==2022.12.0"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
"PythonPath": {},
|
||||
|
Loading…
Reference in New Issue
Block a user