o
    !hb                     @   sz   d dl Z d dlmZ d dlmZ d dlmZ e dZG dd deZ	ded	ee	 fd
dZ
dZdede	d	dfddZdS )    N)Path)Optional)	BaseModelfastapi_clic                   @   s   e Zd ZU eed< eed< dS )	AppConfigapp_idteam_idN)__name__
__module____qualname__str__annotations__ r   r   ^/var/www/html/pro-man-master/venv/lib/python3.10/site-packages/fastapi_cloud_cli/utils/apps.pyr   
   s   
 r   path_to_deployreturnc                 C   sF   | d }t d| | st d d S t d t|jddS )N.fastapicloud/cloud.jsonzLooking for app config at: %szApp config file doesn't existzApp config loaded successfullyutf-8encoding)loggerdebugexistsr   model_validate_json	read_text)r   config_pathr   r   r   get_app_config   s   

r   u&  
> Why do I have a folder named ".fastapicloud" in my project? 🤔
The ".fastapicloud" folder is created when you link a directory to a FastAPI Cloud project.

> What does the "cloud.json" file contain?
The "cloud.json" file contains:
- The ID of the FastAPI app that you linked ("app_id")
- The ID of the team your FastAPI Cloud project is owned by ("team_id")

> Should I commit the ".fastapicloud" folder?
No, you should not commit the ".fastapicloud" folder to your version control system.
That's why there's a ".gitignore" file in this folder.

app_configc                 C   sx   | d }| d }| d }t d| t d| |jjddd |j| dd	 |jtdd	 |d
 t d d S )Nr   z.fastapicloud/README.mdz.fastapicloud/.gitignorezWriting app config to: %szApp config data: %sT)parentsexist_okr   r   *z%App config files written successfully)r   r   parentmkdir
write_textmodel_dump_jsonREADME)r   r   r   readme_pathgitignore_pathr   r   r   write_app_config*   s   
r(   )loggingpathlibr   typingr   pydanticr   	getLoggerr   r   r   r%   r(   r   r   r   r   <module>   s    
