Skip to content

Commit 9e48837

Browse files
fix config
1 parent 1a1d587 commit 9e48837

File tree

10 files changed

+20
-15
lines changed

10 files changed

+20
-15
lines changed

src/gitingest/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import click
88

9-
from config import MAX_FILE_SIZE
9+
from gitingest.config import MAX_FILE_SIZE
1010
from gitingest.repository_ingest import ingest
1111

1212

src/gitingest/config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
""" Configuration file for the project. """
2+
3+
from pathlib import Path
4+
5+
MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB
6+
MAX_DIRECTORY_DEPTH = 20 # Maximum depth of directory traversal
7+
MAX_FILES = 10_000 # Maximum number of files to process
8+
MAX_TOTAL_SIZE_BYTES = 500 * 1024 * 1024 # 500 MB
9+
10+
TMP_BASE_PATH = Path("/tmp/gitingest")

src/gitingest/query_ingestion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import tiktoken
88

9-
from config import MAX_DIRECTORY_DEPTH, MAX_FILES, MAX_TOTAL_SIZE_BYTES
9+
from gitingest.config import MAX_DIRECTORY_DEPTH, MAX_FILES, MAX_TOTAL_SIZE_BYTES
1010
from gitingest.exceptions import (
1111
AlreadyVisitedError,
1212
InvalidNotebookError,

src/gitingest/query_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pathlib import Path
1010
from urllib.parse import unquote, urlparse
1111

12-
from config import MAX_FILE_SIZE, TMP_BASE_PATH
12+
from gitingest.config import MAX_FILE_SIZE, TMP_BASE_PATH
1313
from gitingest.exceptions import InvalidPatternError
1414
from gitingest.ignore_patterns import DEFAULT_IGNORE_PATTERNS
1515
from gitingest.repository_clone import _check_repo_exists, fetch_remote_branch_list
@@ -163,7 +163,7 @@ async def _parse_repo_source(source: str) -> ParsedQuery:
163163

164164
_id = str(uuid.uuid4())
165165
slug = f"{user_name}-{repo_name}"
166-
local_path = Path(TMP_BASE_PATH) / _id / slug
166+
local_path = TMP_BASE_PATH / _id / slug
167167
url = f"https://{host}/{user_name}/{repo_name}"
168168

169169
parsed = ParsedQuery(

src/gitingest/repository_ingest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import inspect
55
import shutil
66

7-
from config import TMP_BASE_PATH
7+
from gitingest.config import TMP_BASE_PATH
88
from gitingest.query_ingestion import run_ingest_query
99
from gitingest.query_parser import ParsedQuery, parse_query
1010
from gitingest.repository_clone import CloneConfig, clone_repo

src/server/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from slowapi.errors import RateLimitExceeded
1818
from starlette.middleware.trustedhost import TrustedHostMiddleware
1919

20-
from config import DELETE_REPO_AFTER, TMP_BASE_PATH
2120
from server.routers import download, dynamic, index
21+
from server.server_config import DELETE_REPO_AFTER, TMP_BASE_PATH
2222
from server.server_utils import limiter
2323

2424
# Load environment variables from .env file

src/server/query_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from fastapi.templating import Jinja2Templates
77
from starlette.templating import _TemplateResponse
88

9-
from config import EXAMPLE_REPOS, MAX_DISPLAY_SIZE
109
from gitingest.query_ingestion import run_ingest_query
1110
from gitingest.query_parser import ParsedQuery, parse_query
1211
from gitingest.repository_clone import CloneConfig, clone_repo
12+
from server.server_config import EXAMPLE_REPOS, MAX_DISPLAY_SIZE
1313
from server.server_utils import Colors, log_slider_to_size
1414

1515
templates = Jinja2Templates(directory="server/templates")

src/server/routers/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from fastapi import APIRouter, HTTPException
44
from fastapi.responses import Response
55

6-
from config import TMP_BASE_PATH
6+
from server.server_config import TMP_BASE_PATH
77

88
router = APIRouter()
99

src/server/routers/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from fastapi.responses import HTMLResponse
55
from fastapi.templating import Jinja2Templates
66

7-
from config import EXAMPLE_REPOS
87
from server.query_processor import process_query
8+
from server.server_config import EXAMPLE_REPOS
99
from server.server_utils import limiter
1010

1111
router = APIRouter()

src/config.py renamed to src/server/server_config.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
""" Configuration file for the project. """
1+
""" Configuration for the server. """
22

33
from pathlib import Path
44

5-
MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB
6-
MAX_DIRECTORY_DEPTH = 20 # Maximum depth of directory traversal
7-
MAX_FILES = 10_000 # Maximum number of files to process
8-
MAX_TOTAL_SIZE_BYTES = 500 * 1024 * 1024 # 500 MB
9-
105
MAX_DISPLAY_SIZE: int = 300_000
116
TMP_BASE_PATH = Path("/tmp/gitingest")
127
DELETE_REPO_AFTER: int = 60 * 60 # In seconds

0 commit comments

Comments
 (0)