Generalize the term 'Gitea webhook configuration' to 'Gitea configuration'

This commit is contained in:
2026-05-11 22:46:37 +02:00
parent 7ca1d4c609
commit 547edfaef0
+11 -11
View File
@@ -24,8 +24,8 @@ import argparse
__all__ = [ __all__ = [
'load_config', 'load_config',
'process_host_and_port', 'process_host_and_port',
'GiteaWebhookConfig', 'GiteaConfig',
'process_gitea_webhook_config', 'process_gitea_config',
] ]
def load_config(config_directory: pathlib.Path) -> tuple[ def load_config(config_directory: pathlib.Path) -> tuple[
@@ -116,9 +116,9 @@ def process_host_and_port(
return host, int(port) return host, int(port)
@dataclass @dataclass
class GiteaWebhookConfig: class GiteaConfig:
enabled: bool enabled: bool
secret_file_path: pathlib.Path webhook_secret_file_path: pathlib.Path
def _is_readable_file(path: pathlib.Path) -> bool: def _is_readable_file(path: pathlib.Path) -> bool:
''' '''
@@ -142,24 +142,24 @@ def _is_readable_file(path: pathlib.Path) -> bool:
return True return True
def process_gitea_webhook_config( def process_gitea_config(
configuration: jcloud_config_parser.ini.INIConfiguration, configuration: jcloud_config_parser.ini.INIConfiguration,
logger: logging.Logger logger: logging.Logger
) -> GiteaWebhookConfig: ) -> GiteaConfig:
''' '''
Processes the Gitea webhook configuration. Processes the Gitea configuration.
:param configuration: The configuration. :param configuration: The configuration.
:type configuration: jcloud_config_parser.ini.INIConfiguration :type configuration: jcloud_config_parser.ini.INIConfiguration
:param logger: The logger. :param logger: The logger.
:type logger: logging.Logger :type logger: logging.Logger
:return: The Gitea webhooks configuration. :return: The Gitea configuration.
:rtype: GiteaWebhookConfig :rtype: GiteaConfig
''' '''
if configuration['gitea'].enabled not in ('true', 'yes', 't', 'y'): 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) 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') 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) 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)