Updated docs
This commit is contained in:
@@ -11,16 +11,16 @@ CPL internal tool to set pip URL for CLI by environment
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'set_pip_urls'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '2022.12.0'
|
||||
__title__ = "set_pip_urls"
|
||||
__author__ = "Sven Heidemann"
|
||||
__license__ = "MIT"
|
||||
__copyright__ = "Copyright (c) 2022 sh-edraft.de"
|
||||
__version__ = "2022.12.0"
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='0')
|
||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||
version_info = VersionInfo(major="2022", minor="12", micro="0")
|
||||
|
@@ -13,7 +13,6 @@ from set_pip_urls.pip_settings import PIPSettings
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
ApplicationABC.__init__(self, config, services)
|
||||
|
||||
@@ -24,7 +23,7 @@ class Application(ApplicationABC):
|
||||
|
||||
def main(self):
|
||||
if self._pip_settings is None:
|
||||
Console.error('appsettings.json not found')
|
||||
Console.error("appsettings.json not found")
|
||||
sys.exit()
|
||||
|
||||
url = None
|
||||
@@ -36,13 +35,11 @@ class Application(ApplicationABC):
|
||||
case EnvironmentNameEnum.development.value:
|
||||
url = self._pip_settings.development
|
||||
|
||||
cli_json = {
|
||||
"CLI": {
|
||||
"PipPath": url
|
||||
}
|
||||
}
|
||||
file = os.path.abspath(os.path.join(self._environment.working_directory, '../../src/cpl_cli', 'appsettings.json'))
|
||||
Console.write_line(f'Writing PipPath: {url} to {file}')
|
||||
with open(file, 'w') as f:
|
||||
cli_json = {"CLI": {"PipPath": url}}
|
||||
file = os.path.abspath(
|
||||
os.path.join(self._environment.working_directory, "../../src/cpl_cli", "appsettings.json")
|
||||
)
|
||||
Console.write_line(f"Writing PipPath: {url} to {file}")
|
||||
with open(file, "w") as f:
|
||||
f.write(json.dumps(cli_json, indent=2))
|
||||
f.close()
|
||||
|
@@ -10,5 +10,5 @@ def main():
|
||||
app_builder.build().run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@@ -7,13 +7,12 @@ from cpl_core.console import Console
|
||||
|
||||
|
||||
class PIPSettings(ConfigurationModelABC):
|
||||
|
||||
def __init__(self):
|
||||
ConfigurationModelABC.__init__(self)
|
||||
|
||||
self._production = ''
|
||||
self._staging = ''
|
||||
self._development = ''
|
||||
self._production = ""
|
||||
self._staging = ""
|
||||
self._development = ""
|
||||
|
||||
@property
|
||||
def production(self):
|
||||
@@ -33,5 +32,5 @@ class PIPSettings(ConfigurationModelABC):
|
||||
self._staging = settings[EnvironmentNameEnum.staging.value]
|
||||
self._development = settings[EnvironmentNameEnum.development.value]
|
||||
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()}')
|
||||
Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
|
||||
Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")
|
||||
|
@@ -5,14 +5,17 @@ from cpl_core.environment import ApplicationEnvironment
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self):
|
||||
StartupABC.__init__(self)
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
configuration.add_environment_variables('CPL_')
|
||||
configuration.add_json_file('appsettings.json', optional=False, output=False)
|
||||
def configure_configuration(
|
||||
self, configuration: ConfigurationABC, environment: ApplicationEnvironment
|
||||
) -> ConfigurationABC:
|
||||
configuration.add_environment_variables("CPL_")
|
||||
configuration.add_json_file("appsettings.json", optional=False, output=False)
|
||||
return configuration
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
def configure_services(
|
||||
self, services: ServiceCollectionABC, environment: ApplicationEnvironment
|
||||
) -> ServiceProviderABC:
|
||||
return services.build_service_provider()
|
||||
|
Reference in New Issue
Block a user