Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/routes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
app.add_middleware(
CORSMiddleware,
allow_origins=settings.CORS_ALLOW_ORIGINS,
allow_credentials=settings.CORS_ALLOW_CREDENTIALS,
allow_methods=settings.CORS_ALLOW_METHODS,
allow_headers=settings.CORS_ALLOW_HEADERS,
allow_credentials=str(settings.CORS_ALLOW_CREDENTIALS),
allow_methods=str(settings.CORS_ALLOW_METHODS),
allow_headers=str(settings.CORS_ALLOW_HEADERS),
)

app.include_router(script_router, prefix='', tags=['User'])
7 changes: 3 additions & 4 deletions app/routes/models/base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict


class Base(BaseModel):
def __repr__(self) -> str:
attrs = []
for k, v in self.__class__.schema().items():
for k, v in self.__class__.model_json_schema().items():
attrs.append(f"{k}={v}")
return "{}({})".format(self.__class__.__name__, ', '.join(attrs))

class Config:
orm_mode = True
model_config = ConfigDict(from_attributes=True, extra="ignore")
2 changes: 1 addition & 1 deletion app/routes/script_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SendOutput(BaseModel):
async def run_script(
action: str,
inp: Input,
user: dict = Depends(UnionAuth(scopes=[] if settings.ALLOWED_SCOPE is None else [settings.ALLOWED_SCOPE]))
user: dict = Depends(UnionAuth(scopes=[] if settings.ALLOWED_SCOPE is None else [settings.ALLOWED_SCOPE])),
):
"""runs a bash script, located in scripts/{action}. The script takes 2 arguments: git_ref and repo_url"""

Expand Down
9 changes: 3 additions & 6 deletions app/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from functools import lru_cache

from pydantic import AnyUrl, BaseSettings, PostgresDsn
from pydantic import AnyUrl, ConfigDict, PostgresDsn
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
Expand All @@ -13,11 +14,7 @@ class Settings(BaseSettings):
CORS_ALLOW_METHODS: list[str] = ['*']
CORS_ALLOW_HEADERS: list[str] = ['*']

class Config:
"""Pydantic BaseSettings config"""

case_sensitive = True
env_file = ".env"
model_config = ConfigDict(case_sensitive=True, env_file=".env", extra="ignore")


@lru_cache
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fastapi
pydantic[dotenv]
pydantic
pydantic_settings
uvicorn
gunicorn
auth_lib_profcomff[fastapi]
Expand Down