Improved comments of environment
This commit is contained in:
parent
a604fca5cc
commit
d1f1627214
@ -11,7 +11,7 @@ from cpl.configuration.console_argument import ConsoleArgument
|
|||||||
from cpl.console.console import Console
|
from cpl.console.console import Console
|
||||||
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
from cpl.console.foreground_color_enum import ForegroundColorEnum
|
||||||
from cpl.environment.application_environment import ApplicationEnvironment
|
from cpl.environment.application_environment import ApplicationEnvironment
|
||||||
from cpl.environment.environment_abc import EnvironmentABC
|
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ class Configuration(ConfigurationABC):
|
|||||||
self._handled_args = []
|
self._handled_args = []
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def environment(self) -> EnvironmentABC:
|
def environment(self) -> ApplicationEnvironmentABC:
|
||||||
return self._hosting_environment
|
return self._hosting_environment
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -4,7 +4,7 @@ from typing import Type, Union, Optional
|
|||||||
|
|
||||||
from cpl.configuration.console_argument import ConsoleArgument
|
from cpl.configuration.console_argument import ConsoleArgument
|
||||||
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
||||||
from cpl.environment.environment_abc import EnvironmentABC
|
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationABC(ABC):
|
class ConfigurationABC(ABC):
|
||||||
@ -14,7 +14,7 @@ class ConfigurationABC(ABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def environment(self) -> EnvironmentABC: pass
|
def environment(self) -> ApplicationEnvironmentABC: pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
@ -8,7 +8,7 @@ from cpl.configuration.configuration_model_abc import ConfigurationModelABC
|
|||||||
from cpl.database.context.database_context_abc import DatabaseContextABC
|
from cpl.database.context.database_context_abc import DatabaseContextABC
|
||||||
from cpl.dependency_injection.service_abc import ServiceABC
|
from cpl.dependency_injection.service_abc import ServiceABC
|
||||||
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
|
||||||
from cpl.environment.environment_abc import EnvironmentABC
|
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||||
|
|
||||||
|
|
||||||
class ServiceProvider(ServiceProviderABC):
|
class ServiceProvider(ServiceProviderABC):
|
||||||
@ -31,7 +31,7 @@ class ServiceProvider(ServiceProviderABC):
|
|||||||
if issubclass(parameter.annotation, ApplicationRuntimeABC):
|
if issubclass(parameter.annotation, ApplicationRuntimeABC):
|
||||||
params.append(self._app_runtime)
|
params.append(self._app_runtime)
|
||||||
|
|
||||||
elif issubclass(parameter.annotation, EnvironmentABC):
|
elif issubclass(parameter.annotation, ApplicationEnvironmentABC):
|
||||||
params.append(self._app_runtime.configuration.environment)
|
params.append(self._app_runtime.configuration.environment)
|
||||||
|
|
||||||
elif issubclass(parameter.annotation, DatabaseContextABC):
|
elif issubclass(parameter.annotation, DatabaseContextABC):
|
||||||
|
@ -20,7 +20,7 @@ __version__ = '2021.4.1.post1'
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# imports:
|
# imports:
|
||||||
from .environment_abc import EnvironmentABC
|
from .environment_abc import ApplicationEnvironmentABC
|
||||||
from .environment_name_enum import EnvironmentNameEnum
|
from .environment_name_enum import EnvironmentNameEnum
|
||||||
from .application_environment import ApplicationEnvironment
|
from .application_environment import ApplicationEnvironment
|
||||||
|
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.environment.environment_abc import EnvironmentABC
|
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
from cpl.environment.environment_name_enum import EnvironmentNameEnum
|
||||||
|
|
||||||
|
|
||||||
class ApplicationEnvironment(EnvironmentABC):
|
class ApplicationEnvironment(ApplicationEnvironmentABC):
|
||||||
|
|
||||||
def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'):
|
def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'):
|
||||||
EnvironmentABC.__init__(self)
|
"""
|
||||||
|
Represents environment of the application
|
||||||
|
:param name:
|
||||||
|
:param crp:
|
||||||
|
"""
|
||||||
|
ApplicationEnvironmentABC.__init__(self)
|
||||||
|
|
||||||
self._environment_name: Optional[EnvironmentNameEnum] = name
|
self._environment_name: Optional[EnvironmentNameEnum] = name
|
||||||
self._app_name: Optional[str] = None
|
self._app_name: Optional[str] = None
|
||||||
|
@ -1,31 +1,35 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
class EnvironmentABC(ABC):
|
class ApplicationEnvironmentABC(ABC):
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self): pass
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
ABC of application environment
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def environment_name(self) -> str: pass
|
def environment_name(self) -> str: pass
|
||||||
|
|
||||||
@environment_name.setter
|
@environment_name.setter
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def environment_name(self, environment_name: str): pass
|
def environment_name(self, environment_name: str): pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def application_name(self) -> str: pass
|
def application_name(self) -> str: pass
|
||||||
|
|
||||||
@application_name.setter
|
@application_name.setter
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def application_name(self, application_name: str): pass
|
def application_name(self, application_name: str): pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def customer(self) -> str: pass
|
def customer(self) -> str: pass
|
||||||
|
|
||||||
@customer.setter
|
@customer.setter
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def customer(self, customer: str): pass
|
def customer(self, customer: str): pass
|
||||||
|
@ -2,7 +2,7 @@ import ssl
|
|||||||
from smtplib import SMTP
|
from smtplib import SMTP
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from cpl.environment.environment_abc import EnvironmentABC
|
from cpl.environment.environment_abc import ApplicationEnvironmentABC
|
||||||
from cpl.logging.logger_abc import LoggerABC
|
from cpl.logging.logger_abc import LoggerABC
|
||||||
from cpl.mailing.email import EMail
|
from cpl.mailing.email import EMail
|
||||||
from cpl.mailing.email_client_abc import EMailClientABC
|
from cpl.mailing.email_client_abc import EMailClientABC
|
||||||
@ -12,7 +12,7 @@ from cpl.utils.credential_manager import CredentialManager
|
|||||||
|
|
||||||
class EMailClient(EMailClientABC):
|
class EMailClient(EMailClientABC):
|
||||||
|
|
||||||
def __init__(self, environment: EnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings):
|
def __init__(self, environment: ApplicationEnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings):
|
||||||
"""
|
"""
|
||||||
Service to send emails
|
Service to send emails
|
||||||
:param environment:
|
:param environment:
|
||||||
|
Loading…
Reference in New Issue
Block a user