o
    t¨ÊhC  ã                   @   s(   d Z ddlZddlZG dd„ deƒZdS )z?Setup 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| jd ƒ�'}t	 
|¡}|d | _|d | _|d | _|d | _|d	 | _W d   ƒ d S 1 sMw   Y  d S )
NÚENVÚprodÚpathz/config.ymlÚ
debug_modeÚendpointÚhostÚkeysÚport)ÚosÚenvironÚgetÚinit_environmentr   ÚabspathÚdirnameÚ__file__ÚopenÚyamlÚloadÚ_debug_modeÚ	_endpointÚ_hostÚ_keysÚ_port)ÚselfÚoptsÚstreamÚconfig© r   úQ/var/www/html/env/lib/python3.10/site-packages/sendgrid/helpers/inbound/config.pyÚ__init__   s   ÿ




"úzConfig.__init__c                  C   sj   t j t j t¡¡} t j | d ¡r1t| d ƒD ]}| ¡  d¡}t	|ƒdkr0|d t j
|d < qdS dS )zVAllow variables assigned in .env available using
           os.environ.get('VAR_NAME')z/.envú=é   é   r   N)r   r   r   r   r   Úexistsr   ÚstripÚsplitÚlenr   )Ú	base_pathÚlineÚvarr   r   r   r      s   €üzConfig.init_environmentc                 C   ó   | j S ©N)r   ©r   r   r   r   r   $   ó   zConfig.debug_modec                 C   r+   r,   )r   r-   r   r   r   r   (   r.   zConfig.endpointc                 C   r+   r,   )r   r-   r   r   r   r   ,   r.   zConfig.hostc                 C   r+   r,   )r   r-   r   r   r   r	   0   r.   zConfig.keysc                 C   r+   r,   )r   r-   r   r   r   r
   4   r.   zConfig.portN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r    Ústaticmethodr   Úpropertyr   r   r   r	   r
   r   r   r   r   r      s    





r   )r2   r   r   Úobjectr   r   r   r   r   Ú<module>   s    