nyacme/nyacme/handlers/http.py

19 lines
548 B
Python

import os
from ..config import Config
from .base import Handler
class HTTPHandler(Handler):
def __init__(self, zone: str, config: Config, token: str) -> None:
super().__init__(zone, config, token)
self.filepath = os.path.join(config.acme_path, token)
def create(self, record_name: str, record_value: str) -> None:
with open(self.filepath, 'w') as f:
f.write(record_value)
def remove(self, record_name: str) -> None:
if os.path.isfile(self.filepath):
os.unlink(self.filepath)