Skip to content

Commit

Permalink
feat: support for private repos
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar5526 committed May 22, 2024
1 parent fcb3dfe commit f58a7fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async def deploy(request: Request, token: dict = Depends(verify_token)):
branch_name=data.get("branch"),
project_git_url=data.get("project_git_url"),
compose_file_location=data.get("compose_file_location"),
gh_token=data.get("gh_token"),
rest_action=request.method,
)
deployer = Deployer(config)
Expand Down
6 changes: 6 additions & 0 deletions server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DeploymentConfig:
project_name: str
branch_name: str
project_git_url: str
gh_token: str
compose_file_location: str = constants.COMPOSE_FILE
rest_action: str = constants.POST

Expand All @@ -45,6 +46,11 @@ def __post_init__(self):
f"{constants.DEFAULT_SECRETS_PATH} is a reserved keyword in Sarthi. Please use a different branch name",
)

if self.gh_token:
self.project_git_url = (
f"{self.project_git_url[:8]}{self.gh_token}:@{self.project_git_url[8:]}"
)

def get_project_hash(self):
return get_random_stub(f"{self.project_name}:{self.branch_name}", 10)

Expand Down

0 comments on commit f58a7fd

Please sign in to comment.