HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/primordial/wsgi/__pycache__/cherrytools.cpython-39.pyc
a

�,�h�@s�ddlmZmZddlZddlZddlmZeeedd�dd�Zeeedd�dd�Z	deeeeeeedd	�d
d�Z
dd
�ZdS)�)�Callable�OptionalN)�Config)�config�api�path�returncCstj�||�t|�dS)z�Start CherryPy running an API.

    :param config: The configuration to use for CherryPy
    :param api: The API callable to be started
    :param path: The path under which the API should respond to requests
    N)�cherrypy�tree�graft�run_cherrypy)rrr�r
�L/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/primordial/wsgi/cherrytools.py�start_cherry
srcCs@tj�||�|�d�}|�d�}|�d�}t||||d�dS)a*Start CherryPy running an API on HTTPS only.

    This is a backport of how ServiceGroup & DNS
    verticals start.

    :param config: The configuration to use for CherryPy
    :param api: The API callable to be started
    :param path: The path under which the API should respond to requests
    Zserver_certZ
server_keyZ	server_ca)�	cert_path�key_path�
ca_certs_pathN)r	r
r�getr)rrr�	cert_fileZ	pkey_fileZ
ca_certs_filer
r
r�start_cherry_httpss


�r)rrrrrcCs�|�d�}tjjj�|�|tjj_|�d�}|�d�}|rh|durhtj�	||d||t
|||�d��n|�d�}tj�	||d��tj��tj��dS)	znRun CherryPy. Called by `start_cherry`.

    :param config: The configuration to use for running CherryPy
    �restart_triggerzserver.hostzserver.https.portN�builtin)�server.socket_host�server.socket_portzserver.ssl_modulezserver.ssl_certificatezserver.ssl_private_keyzserver.ssl_contextzserver.port)rr)
rr	ZengineZ
autoreload�files�add�matchZget_intr�update�ssl_context�start�block)rrrrrZserver_hostZ
https_portZserver_portr
r
rr-s(	




�

�
rcCs*tjtjj|d�}|�||�tj|_|S)a4Create a server SSL context requiring client certificate authentication.
    :param certificate: Path to server certificate.
    :param private_key: Path to server private key.
    :param ca_certs: Path to certificate authority chain against which client
                     certificates are validated.
    )�purpose�cafile)�ssl�create_default_context�Purpose�CLIENT_AUTH�load_cert_chain�
CERT_REQUIRED�verify_mode)ZcertificateZprivate_key�ca_certs�contextr
r
rrPs�r)NNN)�typingrrr#r	Zprimordial.configr�strrrrrr
r
r
r�<module>s��#