Improved configuration

This commit is contained in:
2021-03-03 18:37:39 +01:00
parent ed0b761502
commit b32f846fcf
9 changed files with 164 additions and 56 deletions

View File

@@ -33,13 +33,14 @@ class Application(ApplicationABC):
Console.write_at(5, 5, 'at 5, 5')
Console.write_at(10, 10, 'at 10, 10')
def run(self):
def configure(self):
self._logger = self._services.get_service(LoggerABC)
self._mailer = self._services.get_service(EMailClientABC)
def main(self):
self._logger.header(f'{self._configuration.environment.application_name}:')
self._logger.debug(__name__, f'Host: {self._configuration.environment.host_name}')
self._logger.debug(__name__, f'Environment: {self._configuration.environment.environment_name}')
self._logger.debug(__name__, f'Customer: {self._configuration.environment.customer}')
self.test_send_mail()
# self.test_send_mail()
# self.test_console()

View File

@@ -1,5 +1,5 @@
from tests.Application import Application
from tests.Startup import Startup
from tests.startup import Startup
if __name__ == '__main__':
app = Application()

View File

@@ -32,7 +32,7 @@ class Startup(StartupABC):
def create_configuration(self) -> ConfigurationABC:
self._configuration.add_environment_variables('PYTHON_')
self._configuration.add_environment_variables('CPL_')
self._configuration.add_argument_variables()
self._configuration.add_console_arguments()
self._configuration.add_json_file(f'appsettings.json')
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.environment_name}.json')
self._configuration.add_json_file(f'appsettings.{self._configuration.environment.host_name}.json', optional=True)