generated from jCloud/repository-template
Generalize the term 'Gitea webhook configuration' to 'Gitea configuration'
This commit is contained in:
@@ -24,8 +24,8 @@ import argparse
|
||||
__all__ = [
|
||||
'load_config',
|
||||
'process_host_and_port',
|
||||
'GiteaWebhookConfig',
|
||||
'process_gitea_webhook_config',
|
||||
'GiteaConfig',
|
||||
'process_gitea_config',
|
||||
]
|
||||
|
||||
def load_config(config_directory: pathlib.Path) -> tuple[
|
||||
@@ -116,9 +116,9 @@ def process_host_and_port(
|
||||
return host, int(port)
|
||||
|
||||
@dataclass
|
||||
class GiteaWebhookConfig:
|
||||
class GiteaConfig:
|
||||
enabled: bool
|
||||
secret_file_path: pathlib.Path
|
||||
webhook_secret_file_path: pathlib.Path
|
||||
|
||||
def _is_readable_file(path: pathlib.Path) -> bool:
|
||||
'''
|
||||
@@ -142,24 +142,24 @@ def _is_readable_file(path: pathlib.Path) -> bool:
|
||||
|
||||
return True
|
||||
|
||||
def process_gitea_webhook_config(
|
||||
def process_gitea_config(
|
||||
configuration: jcloud_config_parser.ini.INIConfiguration,
|
||||
logger: logging.Logger
|
||||
) -> GiteaWebhookConfig:
|
||||
) -> GiteaConfig:
|
||||
'''
|
||||
Processes the Gitea webhook configuration.
|
||||
Processes the Gitea configuration.
|
||||
|
||||
:param configuration: The configuration.
|
||||
:type configuration: jcloud_config_parser.ini.INIConfiguration
|
||||
:param logger: The logger.
|
||||
:type logger: logging.Logger
|
||||
|
||||
:return: The Gitea webhooks configuration.
|
||||
:rtype: GiteaWebhookConfig
|
||||
:return: The Gitea configuration.
|
||||
:rtype: GiteaConfig
|
||||
'''
|
||||
|
||||
if configuration['gitea'].enabled not in ('true', 'yes', 't', 'y'):
|
||||
return GiteaWebhookConfig(False, None)
|
||||
return GiteaConfig(False, None)
|
||||
|
||||
secret_file_path = pathlib.Path(configuration['gitea'].webhook_secret_file)
|
||||
|
||||
@@ -167,4 +167,4 @@ def process_gitea_webhook_config(
|
||||
logger.critical(f'{secret_file_path}: Cannot read Gitea webhook secret file')
|
||||
raise Fail(f'{secret_file_path}: Cannot read Gitea webhook secret file', exit_code = 2)
|
||||
|
||||
return GiteaWebhookConfig(True, secret_file_path)
|
||||
return GiteaConfig(True, secret_file_path)
|
||||
Reference in New Issue
Block a user