INNER CODE UNIT · Python

get_traefik_cert_store

ahembree/ansible-hms-docker · roles/hmsdocker/files/scripts/traefik_cert_convert.py:142

def get_traefik_cert_store(path: str) -> dict:
    """Gets the Traefik certificate store data

    Args:
        ``path`` (``str``): The path to the Traefik certificate file (default: acme.json)

    Returns:
        ``dict``: The Traefik certificate file in JSON/dict format
    """    
    try:
        logging.debug(f'Attempting to load Traefik certificate store file')
        # deepcode ignore PT: Script allows user to input path to cert file
        json_data = json.load(open(path, 'r'))
    except FileNotFoundError as e:
        logging.error(f'Failed to find certificate file at {path}, has Traefik successfully created one? (Error: {e})')
        sys.exit(1)
    except PermissionError as e:
        logging.error(f'Permission denied, try running with sudo (Error: {e})')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…