Updated config & environment
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from cpl.core.application.async_startup_abc import AsyncStartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl.core.environment import ApplicationEnvironment
|
||||
from cpl.core.environment import Environment
|
||||
|
||||
|
||||
class Startup(AsyncStartupABC):
|
||||
@@ -9,11 +9,11 @@ class Startup(AsyncStartupABC):
|
||||
AsyncStartupABC.__init__(self)
|
||||
|
||||
async def configure_configuration(
|
||||
self, configuration: ConfigurationABC, environment: ApplicationEnvironment
|
||||
self, configuration: ConfigurationABC, environment: Environment
|
||||
) -> ConfigurationABC:
|
||||
return configuration
|
||||
|
||||
async def configure_services(
|
||||
self, services: ServiceCollectionABC, environment: ApplicationEnvironment
|
||||
self, services: ServiceCollectionABC, environment: Environment
|
||||
) -> ServiceProviderABC:
|
||||
return services.build_service_provider()
|
||||
|
||||
@@ -2,7 +2,7 @@ from cpl.core.application import StartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.database import DatabaseSettings
|
||||
from cpl.core.dependency_injection import ServiceCollectionABC, ServiceProviderABC
|
||||
from cpl.core.environment import ApplicationEnvironmentABC
|
||||
from cpl.core.environment import EnvironmentABC
|
||||
from cpl.core.log import Logger, LoggerABC
|
||||
|
||||
from model.db_context import DBContext
|
||||
@@ -17,7 +17,7 @@ class Startup(StartupABC):
|
||||
self._configuration = None
|
||||
|
||||
def configure_configuration(
|
||||
self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC
|
||||
self, configuration: ConfigurationABC, environment: EnvironmentABC
|
||||
) -> ConfigurationABC:
|
||||
configuration.add_environment_variables("PYTHON_")
|
||||
configuration.add_environment_variables("CPL_")
|
||||
@@ -30,7 +30,7 @@ class Startup(StartupABC):
|
||||
return configuration
|
||||
|
||||
def configure_services(
|
||||
self, services: ServiceCollectionABC, environment: ApplicationEnvironmentABC
|
||||
self, services: ServiceCollectionABC, environment: EnvironmentABC
|
||||
) -> ServiceProviderABC:
|
||||
# Create and connect to database
|
||||
self._configuration.parse_console_arguments(services)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from cpl.core.application import StartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl.core.environment import ApplicationEnvironment
|
||||
from cpl.core.environment import Environment
|
||||
from di.test1_service import Test1Service
|
||||
from di.test2_service import Test2Service
|
||||
from di.test_abc import TestABC
|
||||
@@ -15,12 +15,12 @@ class Startup(StartupABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(
|
||||
self, configuration: ConfigurationABC, environment: ApplicationEnvironment
|
||||
self, configuration: ConfigurationABC, environment: Environment
|
||||
) -> ConfigurationABC:
|
||||
return configuration
|
||||
|
||||
def configure_services(
|
||||
self, services: ServiceCollectionABC, environment: ApplicationEnvironment
|
||||
self, services: ServiceCollectionABC, environment: Environment
|
||||
) -> ServiceProviderABC:
|
||||
services.add_scoped(TestService)
|
||||
services.add_scoped(DITesterService)
|
||||
|
||||
@@ -2,20 +2,22 @@ import time
|
||||
from typing import Optional
|
||||
|
||||
from cpl.core.application.application_abc import ApplicationABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.core.console import Console
|
||||
from cpl.core.dependency_injection import ServiceProviderABC
|
||||
from cpl.core.environment import Environment
|
||||
from cpl.core.log import LoggerABC
|
||||
from cpl.core.pipes import IPAddressPipe
|
||||
from cpl.mail import EMail, EMailClientABC
|
||||
from test_settings import TestSettings
|
||||
from test_service import TestService
|
||||
from cpl.query.extension.list import List
|
||||
from test_service import TestService
|
||||
from test_settings import TestSettings
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
def __init__(self, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, services)
|
||||
self._logger: Optional[LoggerABC] = None
|
||||
self._mailer: Optional[EMailClientABC] = None
|
||||
|
||||
@@ -25,7 +27,7 @@ class Application(ApplicationABC):
|
||||
mail.add_header("Content-Type: text/plain; charset=utf-8")
|
||||
mail.add_header("Content-Transfer-Encoding: quoted-printable")
|
||||
mail.add_receiver("sven.heidemann@sh-edraft.de")
|
||||
mail.subject = f"Test - {self._configuration.environment.host_name}"
|
||||
mail.subject = f"Test - {Environment.get_host_name()}"
|
||||
mail.body = "Dies ist ein Test :D"
|
||||
self._mailer.send_mail(mail)
|
||||
|
||||
@@ -38,14 +40,8 @@ class Application(ApplicationABC):
|
||||
self._mailer = self._services.get_service(EMailClientABC)
|
||||
|
||||
def main(self):
|
||||
self._configuration.parse_console_arguments(self._services)
|
||||
|
||||
if self._configuration.environment.application_name != "":
|
||||
self._logger.header(f"{self._configuration.environment.application_name}:")
|
||||
self._logger.debug(f"Args: {self._configuration.additional_arguments}")
|
||||
self._logger.debug(f"Host: {self._configuration.environment.host_name}")
|
||||
self._logger.debug(f"Environment: {self._configuration.environment.environment_name}")
|
||||
self._logger.debug(f"Customer: {self._configuration.environment.customer}")
|
||||
self._logger.debug(f"Host: {Environment.get_host_name()}")
|
||||
self._logger.debug(f"Environment: {Environment.get_environment()}")
|
||||
Console.write_line(List(int, range(0, 10)).select(lambda x: f"x={x}").to_list())
|
||||
Console.spinner("Test", self._wait, 2, spinner_foreground_color="red")
|
||||
test: TestService = self._services.get_service(TestService)
|
||||
@@ -61,12 +57,12 @@ class Application(ApplicationABC):
|
||||
with self._services.create_scope() as s:
|
||||
Console.write_line("with scope", s)
|
||||
|
||||
test_settings = self._configuration.get_configuration(TestSettings)
|
||||
test_settings = Configuration.get(TestSettings)
|
||||
Console.write_line(test_settings.value)
|
||||
Console.write_line("reload config")
|
||||
self._configuration.add_json_file(f"appsettings.json")
|
||||
self._configuration.add_json_file(f"appsettings.{self._environment.environment_name}.json")
|
||||
self._configuration.add_json_file(f"appsettings.{self._environment.host_name}.json", optional=True)
|
||||
test_settings1 = self._configuration.get_configuration(TestSettings)
|
||||
Configuration.add_json_file(f"appsettings.json")
|
||||
Configuration.add_json_file(f"appsettings.{Environment.get_environment()}.json")
|
||||
Configuration.add_json_file(f"appsettings.{Environment.get_host_name()}.json", optional=True)
|
||||
test_settings1 = Configuration.get(TestSettings)
|
||||
Console.write_line(test_settings1.value)
|
||||
# self.test_send_mail()
|
||||
# self.test_send_mail()
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
from cpl.core.configuration import ConfigurationABC, ArgumentExecutableABC
|
||||
from cpl.core.console import Console
|
||||
from cpl.core.environment import ApplicationEnvironmentABC
|
||||
|
||||
|
||||
class GenerateArgument(ArgumentExecutableABC):
|
||||
def __init__(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
ArgumentExecutableABC.__init__(self)
|
||||
self._config = config
|
||||
self._env = env
|
||||
|
||||
def execute(self, args: list[str]):
|
||||
Console.error("Generate:")
|
||||
Console.write_line(args, self._env.environment_name)
|
||||
@@ -1,10 +0,0 @@
|
||||
from cpl.core.configuration import ArgumentExecutableABC
|
||||
from cpl.core.console import Console
|
||||
|
||||
|
||||
class InstallArgument(ArgumentExecutableABC):
|
||||
def __init__(self):
|
||||
ArgumentExecutableABC.__init__(self)
|
||||
|
||||
def execute(self, args: list[str]):
|
||||
Console.write_line("Install:", args)
|
||||
@@ -3,13 +3,11 @@ from cpl.core.application import ApplicationBuilder
|
||||
from test_extension import TestExtension
|
||||
from startup import Startup
|
||||
from test_startup_extension import TestStartupExtension
|
||||
from parameter_startup import ParameterStartup
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.use_startup(Startup)
|
||||
app_builder.use_extension(ParameterStartup)
|
||||
app_builder.use_extension(TestStartupExtension)
|
||||
app_builder.use_extension(TestExtension)
|
||||
app_builder.build().run()
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
from arguments.generate_argument import GenerateArgument
|
||||
from arguments.install_argument import InstallArgument
|
||||
from cpl.core.application import StartupExtensionABC
|
||||
from cpl.core.configuration import ConfigurationABC, ArgumentTypeEnum
|
||||
from cpl.core.dependency_injection import ServiceCollectionABC
|
||||
from cpl.core.environment import ApplicationEnvironmentABC
|
||||
|
||||
|
||||
class ParameterStartup(StartupExtensionABC):
|
||||
def __init__(self):
|
||||
StartupExtensionABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
config.create_console_argument(
|
||||
ArgumentTypeEnum.Executable, "", "generate", ["g", "G"], GenerateArgument
|
||||
).add_console_argument(ArgumentTypeEnum.Variable, "", "abc", ["a", "A"], " ").add_console_argument(
|
||||
ArgumentTypeEnum.Variable, "", "class", ["c", "C"], " "
|
||||
).add_console_argument(
|
||||
ArgumentTypeEnum.Variable, "", "enum", ["e", "E"], " "
|
||||
).add_console_argument(
|
||||
ArgumentTypeEnum.Variable, "", "service", ["s", "S"], " "
|
||||
).add_console_argument(
|
||||
ArgumentTypeEnum.Variable, "", "settings", ["st", "ST"], " "
|
||||
).add_console_argument(
|
||||
ArgumentTypeEnum.Variable, "", "thread", ["t", "T"], " "
|
||||
).add_console_argument(
|
||||
ArgumentTypeEnum.Variable, "-", "o", ["o", "O"], "="
|
||||
).add_console_argument(
|
||||
ArgumentTypeEnum.Flag, "--", "virtual", ["v", "V"]
|
||||
)
|
||||
config.create_console_argument(
|
||||
ArgumentTypeEnum.Executable, "", "install", ["i", "I"], InstallArgument
|
||||
).add_console_argument(ArgumentTypeEnum.Flag, "--", "virtual", ["v", "V"]).add_console_argument(
|
||||
ArgumentTypeEnum.Flag, "--", "simulate", ["s", "S"]
|
||||
)
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
services.add_transient(GenerateArgument).add_singleton(InstallArgument)
|
||||
@@ -1,9 +1,7 @@
|
||||
from cpl.core.application import StartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.core.dependency_injection import ServiceCollectionABC, ServiceProviderABC
|
||||
from cpl.core.environment import ApplicationEnvironmentABC
|
||||
from cpl.core.log import Logger, LoggerABC
|
||||
from cpl.mail import EMailClient, EMailClientABC
|
||||
from cpl.core.environment import Environment
|
||||
from cpl.core.pipes import IPAddressPipe
|
||||
from test_service import TestService
|
||||
|
||||
@@ -12,14 +10,12 @@ class Startup(StartupABC):
|
||||
def __init__(self):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC) -> ConfigurationABC:
|
||||
config.add_environment_variables("PYTHON_")
|
||||
config.add_environment_variables("CPLT_")
|
||||
def configure_configuration(self, config: Configuration, env: Environment):
|
||||
config.add_json_file(f"appsettings.json")
|
||||
config.add_json_file(f"appsettings.{config.environment.environment_name}.json")
|
||||
config.add_json_file(f"appsettings.{config.environment.host_name}.json", optional=True)
|
||||
config.add_json_file(f"appsettings.{env.get_environment()}.json")
|
||||
config.add_json_file(f"appsettings.{env.get_host_name()}.json", optional=True)
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC) -> ServiceProviderABC:
|
||||
def configure_services(self, services: ServiceCollectionABC, env: Environment):
|
||||
services.add_logging()
|
||||
services.add_mail()
|
||||
services.add_transient(IPAddressPipe)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from cpl.core.application import ApplicationExtensionABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.core.console import Console
|
||||
from cpl.core.dependency_injection import ServiceProviderABC
|
||||
|
||||
@@ -8,5 +8,5 @@ class TestExtension(ApplicationExtensionABC):
|
||||
def __init__(self):
|
||||
ApplicationExtensionABC.__init__(self)
|
||||
|
||||
def run(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
def run(self, config: Configuration, services: ServiceProviderABC):
|
||||
Console.write_line("Hello World from App Extension")
|
||||
|
||||
@@ -4,11 +4,10 @@ from cpl.core.pipes.ip_address_pipe import IPAddressPipe
|
||||
|
||||
|
||||
class TestService:
|
||||
def __init__(self, provider: ServiceProviderABC, ip_pipe: IPAddressPipe):
|
||||
def __init__(self, provider: ServiceProviderABC):
|
||||
self._provider = provider
|
||||
self._ip_pipe = ip_pipe
|
||||
|
||||
def run(self):
|
||||
Console.write_line("Hello World!", self._provider)
|
||||
ip = [192, 168, 178, 30]
|
||||
Console.write_line(ip, self._ip_pipe.transform(ip))
|
||||
Console.write_line(ip, IPAddressPipe.to_str(ip))
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
from cpl.core.application import StartupExtensionABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.core.console import Console
|
||||
from cpl.core.dependency_injection import ServiceCollectionABC
|
||||
from cpl.core.environment import ApplicationEnvironmentABC
|
||||
from cpl.core.environment import Environment
|
||||
|
||||
|
||||
class TestStartupExtension(StartupExtensionABC):
|
||||
def __init__(self):
|
||||
StartupExtensionABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
def configure_configuration(self, config: Configuration, env: Environment):
|
||||
Console.write_line("config")
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
def configure_services(self, services: ServiceCollectionABC, env: Environment):
|
||||
Console.write_line("services")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from cpl.core.application import StartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
from cpl.core.environment import ApplicationEnvironment
|
||||
from cpl.core.environment import Environment
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
@@ -9,13 +9,13 @@ class Startup(StartupABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(
|
||||
self, configuration: ConfigurationABC, environment: ApplicationEnvironment
|
||||
self, configuration: ConfigurationABC, environment: Environment
|
||||
) -> ConfigurationABC:
|
||||
configuration.add_json_file("appsettings.json")
|
||||
return configuration
|
||||
|
||||
def configure_services(
|
||||
self, services: ServiceCollectionABC, environment: ApplicationEnvironment
|
||||
self, services: ServiceCollectionABC, environment: Environment
|
||||
) -> ServiceProviderABC:
|
||||
services.add_translation()
|
||||
return services.build_service_provider()
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"WorkspaceSettings": {
|
||||
"DefaultProject": "simple-app",
|
||||
"Projects": {
|
||||
"simple-app": "src/simple_app/simple-app.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-app",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "simple-app",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def main(self):
|
||||
Console.write_line("Hello World")
|
||||
@@ -1,12 +0,0 @@
|
||||
from cpl.core.application import ApplicationBuilder
|
||||
|
||||
from application import Application
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,15 +0,0 @@
|
||||
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)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def main(self):
|
||||
Console.write_line("Hello World")
|
||||
@@ -1,12 +0,0 @@
|
||||
from cpl.core.application import ApplicationBuilder
|
||||
|
||||
from simple_app.application import Application
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-app",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.1rc2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "simple_app.main",
|
||||
"EntryPoint": "simple-app",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"WorkspaceSettings": {
|
||||
"DefaultProject": "simple-console",
|
||||
"Projects": {
|
||||
"simple-console": "src/simple_console/simple-console.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-console",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "simple-console",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
from cpl.core.console import Console
|
||||
|
||||
|
||||
def main():
|
||||
Console.write_line("Hello World")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,9 +0,0 @@
|
||||
from cpl.core.console import Console
|
||||
|
||||
|
||||
def main():
|
||||
Console.write_line("Hello World")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-console",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.1rc2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "simple_console.main",
|
||||
"EntryPoint": "simple-console",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"WorkspaceSettings": {
|
||||
"DefaultProject": "simple-di",
|
||||
"Projects": {
|
||||
"simple-di": "src/simple_di/simple-di.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-di",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.2.dev1"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "simple-di",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
from cpl.core.configuration import Configuration, ConfigurationABC
|
||||
from cpl.core.console import Console
|
||||
from cpl.core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||
|
||||
|
||||
def configure_configuration() -> ConfigurationABC:
|
||||
config = Configuration()
|
||||
return config
|
||||
|
||||
|
||||
def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
|
||||
services = ServiceCollection(config)
|
||||
return services.build_service_provider()
|
||||
|
||||
|
||||
def main():
|
||||
config = configure_configuration()
|
||||
provider = configure_services(config)
|
||||
Console.write_line("Hello World")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,23 +0,0 @@
|
||||
from cpl.core.configuration import Configuration, ConfigurationABC
|
||||
from cpl.core.console import Console
|
||||
from cpl.core.dependency_injection import ServiceCollection, ServiceProviderABC
|
||||
|
||||
|
||||
def configure_configuration() -> ConfigurationABC:
|
||||
config = Configuration()
|
||||
return config
|
||||
|
||||
|
||||
def configure_services(config: ConfigurationABC) -> ServiceProviderABC:
|
||||
services = ServiceCollection(config)
|
||||
return services.build_service_provider()
|
||||
|
||||
|
||||
def main():
|
||||
config = configure_configuration()
|
||||
provider = configure_services(config)
|
||||
Console.write_line("Hello World")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-di",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.1rc2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "simple_di.main",
|
||||
"EntryPoint": "simple-di",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"WorkspaceSettings": {
|
||||
"DefaultProject": "simple-startup-app",
|
||||
"Projects": {
|
||||
"simple-startup-app": "src/simple_startup_app/simple-startup-app.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def main(self):
|
||||
Console.write_line("Hello World")
|
||||
@@ -1,14 +0,0 @@
|
||||
from cpl.core.application import ApplicationBuilder
|
||||
|
||||
from simple_startup_app.application import Application
|
||||
from simple_startup_app.startup import Startup
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.use_startup(Startup)
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "simple-startup-app",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.1rc2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "simple_startup_app.main",
|
||||
"EntryPoint": "simple-startup-app",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
from cpl.core.application import StartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
self._configuration = config
|
||||
self._environment = self._configuration.environment
|
||||
self._services = services
|
||||
|
||||
def configure_configuration(self) -> ConfigurationABC:
|
||||
return self._configuration
|
||||
|
||||
def configure_services(self) -> ServiceProviderABC:
|
||||
return self._services.build_service_provider()
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "startup-app",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl==2021.4.2"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "src",
|
||||
"OutputPath": "dist",
|
||||
"Main": "main",
|
||||
"EntryPoint": "startup-app",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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)
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def main(self):
|
||||
Console.write_line("Hello World")
|
||||
@@ -1,14 +0,0 @@
|
||||
from cpl.core.application import ApplicationBuilder
|
||||
|
||||
from application import Application
|
||||
from startup import Startup
|
||||
|
||||
|
||||
def main():
|
||||
app_builder = ApplicationBuilder(Application)
|
||||
app_builder.use_startup(Startup)
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,18 +0,0 @@
|
||||
from cpl.core.application import StartupABC
|
||||
from cpl.core.configuration import ConfigurationABC
|
||||
from cpl.core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
self._configuration = config
|
||||
self._environment = self._configuration.environment
|
||||
self._services = services
|
||||
|
||||
def configure_configuration(self) -> ConfigurationABC:
|
||||
return self._configuration
|
||||
|
||||
def configure_services(self) -> ServiceProviderABC:
|
||||
return self._services.build_service_provider()
|
||||
Reference in New Issue
Block a user