INNER CODE UNIT · Python

main

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

def main():
    parser = argparse.ArgumentParser(
        prog='traefik-to-plex-pkcs12',
        description='Converts a Traefik certificate file to PKCS12 format and applies it to a Plex server'
    )
    parser.add_argument('-r', '--restart-plex', choices=[True, False], default=PLEX_RESTART, help='Whether or not to restart the Plex container when updating the server config')
    parser.add_argument('-s', '--hostname', default=PLEX_PUBLIC_HOSTNAME, help='The publicly accessible hostname to access the Plex server. Must be in scope of the certificate domain or a SAN')
    parser.add_argument('-p', '--passphrase', default=PLEX_CERT_PASSPHRASE, help='Passphrase to protect the PKSC12 certificate file')
    parser.add_argument('-c', '--plex-config', default=f'{PLEX_CONFIG_DIR}/Library/Application Support/Plex Media Server/Preferences.xml', help='Path to the Plex servers Preferences.xml file')
    parser.add_argument('-m', '--modify-plex-config', choices=[True, False], default=PLEX_MODIFY_CONFIG, help='If True, this will update the Plex config file to point to the converted certificate file')
    parser.add_argument('-t', '--traefik-cert-file', default=f'{TRAEFIK_CERT_DIR}/acme.json', help='Path to Traefik certificate file')
    parser.add_argument('-n', '--compose-project', default=COMPOSE_PROJECT, help='Name of the Docker Compose project where the target containers are running')
    args = parser.parse_args()
    restart = args.restart_plex
    compose_project = args.compose_project
    passphrase = args.passphrase
    traefik_cert_file_path = args.traefik_cert_file
    plex_config_path = args.plex_config

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…