o
    w+fU                     @   s(   d Z ddlZddlZG dd deZdS )z@Set up credentials (.env) and application variables (config.yml)    Nc                   @   s`   e Zd ZdZdd Zedd Zedd Zedd	 Z	ed
d Z
edd Zedd ZdS )Configz-All configuration for this app is loaded herec                 K   s   t jddkr|   	 |dt jt jt| _td	| j*}t
j|t
jd}|d | _|d | _|d | _|d	 | _|d
 | _W d    d S 1 sQw   Y  d S )NENVprodpathz{0}/config.yml)Loader
debug_modeendpointhostkeysport)osenvirongetinit_environmentr   abspathdirname__file__openformatyamlload
FullLoader_debug_mode	_endpoint_host_keys_port)selfoptsstreamconfig r!   R/var/www/html/venv/lib/python3.10/site-packages/sendgrid/helpers/inbound/config.py__init__	   s   



"zConfig.__init__c                  C   s   t jt jt} d| }t j|rKt|(}| }|D ]}|	 
d}t|dkr8|d t j|d < q W d   dS 1 sDw   Y  dS dS )zVAllow variables assigned in .env available using
           os.environ.get('VAR_NAME')z{0}/.env=      r   N)r   r   r   r   r   r   existsr   	readlinesstripsplitlenr   )	base_pathenv_pathflineslinevarr!   r!   r"   r      s   

"zConfig.init_environmentc                 C      | j S )z.Flask debug mode - set to False in production.)r   r   r!   r!   r"   r   (      zConfig.debug_modec                 C   r2   )z(Endpoint to receive Inbound Parse POSTs.)r   r3   r!   r!   r"   r   -   r4   zConfig.endpointc                 C   r2   )z!URL that the sender will POST to.)r   r3   r!   r!   r"   r	   2   r4   zConfig.hostc                 C   r2   )zIncoming Parse fields to parse. For reference, see
        https://sendgrid.com/docs/Classroom/Basics/Inbound_Parse_Webhook/setting_up_the_inbound_parse_webhook.html
        )r   r3   r!   r!   r"   r
   7   s   zConfig.keysc                 C   r2   )zPort to listen on.)r   r3   r!   r!   r"   r   >   r4   zConfig.portN)__name__
__module____qualname____doc__r#   staticmethodr   propertyr   r   r	   r
   r   r!   r!   r!   r"   r      s    




r   )r8   r   r   objectr   r!   r!   r!   r"   <module>   s    