Added some config files
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
from cpl_core.application import ApplicationABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
self._bot: BotService = services.get_service(BotServiceABC)
|
||||
self._logger: LoggerABC = services.get_service(LoggerABC)
|
||||
|
||||
async def configure(self):
|
||||
pass
|
||||
|
||||
async def main(self):
|
||||
Console.write_line('Hello World')
|
||||
try:
|
||||
await self._bot.run()
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'A fatal error occured starting the bot', e)
|
||||
|
15
src/gismo/appsettings.development.json
Normal file
15
src/gismo/appsettings.development.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
}
|
||||
}
|
5
src/gismo/appsettings.edrafts-pc.json
Normal file
5
src/gismo/appsettings.edrafts-pc.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"Discord": {
|
||||
"Token": ""
|
||||
}
|
||||
}
|
15
src/gismo/appsettings.production.json
Normal file
15
src/gismo/appsettings.production.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
}
|
||||
}
|
15
src/gismo/appsettings.staging.json
Normal file
15
src/gismo/appsettings.staging.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "DEBUG"
|
||||
}
|
||||
}
|
@@ -17,7 +17,8 @@
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"sh_cpl-core>=2021.10.2",
|
||||
"sh_cpl-query>=2021.10.2"
|
||||
"sh_cpl-query>=2021.10.2",
|
||||
"discord.py==1.7.3"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {
|
||||
|
@@ -2,8 +2,8 @@ import asyncio
|
||||
|
||||
from cpl_core.application import ApplicationBuilder
|
||||
|
||||
from gismo.application import Application
|
||||
from gismo.startup import Startup
|
||||
from application import Application
|
||||
from startup import Startup
|
||||
|
||||
|
||||
async def main():
|
||||
|
@@ -3,6 +3,9 @@ from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
|
||||
from gismo_core.abc.bot_service_abc import BotServiceABC
|
||||
from gismo_core.services.bot_service import BotService
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
@@ -10,7 +13,17 @@ class Startup(StartupABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
async def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
configuration.add_environment_variables('GISMO_')
|
||||
configuration.add_console_arguments()
|
||||
configuration.add_json_file(f'appsettings.json', optional=False)
|
||||
configuration.add_json_file(f'appsettings.{environment.environment_name}.json', optional=True)
|
||||
configuration.add_json_file(f'appsettings.{environment.host_name}.json', optional=True)
|
||||
|
||||
return configuration
|
||||
|
||||
async def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
services.add_logging()
|
||||
|
||||
services.add_singleton(BotServiceABC, BotService)
|
||||
|
||||
return services.build_service_provider()
|
||||
|
Reference in New Issue
Block a user