Skip to content

Commit ce09070

Browse files
committed
🔒 Exclude .env files from deployment uploads
1 parent e19a14e commit ce09070

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/fastapi_cloud_cli/commands/deploy.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

‎tests/test_deploy_utils.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
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
)
2429
def 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
)
4249
def test_includes_paths(path: Path) -> None:

0 commit comments

Comments
 (0)