refactor: use slots and strongly typed properties
This commit is contained in:
+15
-7
@@ -6,7 +6,7 @@ import subprocess
|
||||
import typing
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from . import params
|
||||
from .params import Parameters
|
||||
|
||||
|
||||
class CertManagerError(Exception):
|
||||
@@ -14,16 +14,24 @@ class CertManagerError(Exception):
|
||||
|
||||
|
||||
class CertManager:
|
||||
__slots__ = [
|
||||
"certbot_conf",
|
||||
"certbot_www",
|
||||
"logger",
|
||||
"self_signed_path",
|
||||
"with_certbot",
|
||||
]
|
||||
|
||||
SELF_SIGNED_DAYS = 30
|
||||
CRT_FILE = "fullchain.pem"
|
||||
KEY_FILE = "privkey.pem"
|
||||
|
||||
def __init__(self, params: params.Parameters) -> None:
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
self.certbot_conf = pathlib.Path(params.certbot_conf)
|
||||
self.certbot_www = pathlib.Path(params.certbot_www)
|
||||
self.self_signed_path = pathlib.Path(params.self_signed_path)
|
||||
self.with_certbot = params.with_certbot
|
||||
def __init__(self, params: Parameters) -> None:
|
||||
self.logger: logging.Logger = logging.getLogger(self.__class__.__name__)
|
||||
self.certbot_conf: pathlib.Path = pathlib.Path(params.certbot_conf)
|
||||
self.certbot_www: pathlib.Path = pathlib.Path(params.certbot_www)
|
||||
self.self_signed_path: pathlib.Path = pathlib.Path(params.self_signed_path)
|
||||
self.with_certbot: bool = params.with_certbot
|
||||
|
||||
def init(self, hosts: list[str]) -> None:
|
||||
self.logger.debug("Initializing...")
|
||||
|
||||
Reference in New Issue
Block a user