File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
src/fastapi_cloud_cli/commands Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ def _should_exclude_entry(path: Path) -> bool:
6262 if path .suffix == ".pyc" :
6363 return True
6464
65+ if path .name == ".env" or path .name .startswith (".env." ):
66+ return True
67+
6568 return False
6669
6770
Original file line number Diff line number Diff line change @@ -143,12 +143,13 @@ def test_archive_respects_fastapicloudignore_unignore(
143143 }
144144
145145
146- def test_archive_includes_hidden_files (
146+ def test_archive_includes_hidden_files_but_excludes_env (
147147 src_path : Path , tar_path : Path , dst_path : Path
148148) -> None :
149- """Should include hidden files in the archive by default ."""
149+ """Should include hidden files but exclude .env files ."""
150150 (src_path / "main.py" ).write_text ("print('hello')" )
151151 (src_path / ".env" ).write_text ("SECRET_KEY=xyz" )
152+ (src_path / ".env.local" ).write_text ("LOCAL_KEY=abc" )
152153 (src_path / ".config" ).mkdir ()
153154 (src_path / ".config" / "settings.json" ).write_text ('{"setting": "value"}' )
154155
@@ -159,7 +160,6 @@ def test_archive_includes_hidden_files(
159160
160161 assert set (dst_path .glob ("**/*" )) == {
161162 dst_path / "main.py" ,
162- dst_path / ".env" ,
163163 dst_path / ".config" ,
164164 dst_path / ".config" / "settings.json" ,
165165 }
Original file line number Diff line number Diff line change 1919 Path (".venv" ),
2020 Path ("__pycache__" ),
2121 Path ("module.pyc" ),
22+ Path ("/project/.env" ),
23+ Path ("/project/.env.local" ),
24+ Path ("/project/.env.production" ),
25+ Path (".env" ),
26+ Path (".env.development" ),
2227 ],
2328)
2429def test_excludes_paths (path : Path ) -> None :
@@ -37,6 +42,8 @@ def test_excludes_paths(path: Path) -> None:
3742 Path ("/project/src/module.pyx" ), # similar to .pyc but different
3843 Path ("/project/config.json" ),
3944 Path ("/project/README.md" ),
45+ Path ("/project/.envrc" ), # not a .env file
46+ Path ("/project/env.py" ), # not a .env file
4047 ],
4148)
4249def test_includes_paths (path : Path ) -> None :
You can’t perform that action at this time.
0 commit comments