removed ALLOW_ANY_API_KEY and allow skipping API key check in debug

This commit is contained in:
Yannic Kilcher
2022-12-25 17:25:30 +01:00
parent db10c52877
commit 21f44d2d4c
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -50,7 +50,7 @@
network_mode: oasst
env:
POSTGRES_HOST: oasst-postgres
ALLOW_ANY_API_KEY: "true"
DEBUG_SKIP_API_KEY_CHECK: "true"
MAX_WORKERS: "1"
ports:
- 8080:8080
+2 -2
View File
@@ -37,8 +37,8 @@ def api_auth(
db: Session,
) -> ApiClient:
if api_key is not None:
if settings.ALLOW_ANY_API_KEY:
if api_key is not None or settings.DEBUG_SKIP_API_KEY_CHECK:
if settings.DEBUG_SKIP_API_KEY_CHECK:
# make sure that a dummy api key exits in db (foreign key references)
ANY_API_KEY_ID = UUID("00000000-1111-2222-3333-444444444444")
api_client: ApiClient = db.query(ApiClient).filter(ApiClient.id == ANY_API_KEY_ID).first()
+1 -1
View File
@@ -15,7 +15,7 @@ class Settings(BaseSettings):
POSTGRES_DB: str = "postgres"
DATABASE_URI: Optional[PostgresDsn] = None
ALLOW_ANY_API_KEY: bool = False
DEBUG_SKIP_API_KEY_CHECK: bool = False
@validator("DATABASE_URI", pre=True)
def assemble_db_connection(cls, v: Optional[str], values: Dict[str, Any]) -> Any:
+1 -1
View File
@@ -4,7 +4,7 @@ parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# switch to backend directory
pushd "$parent_path/../../backend"
export ALLOW_ANY_API_KEY=True
export DEBUG_SKIP_API_KEY_CHECK=True
uvicorn main:app --reload --port 8080 --host 0.0.0.0
@@ -35,7 +35,7 @@ services:
image: oasst-backend
environment:
- POSTGRES_HOST=db
- ALLOW_ANY_API_KEY=True
- DEBUG_SKIP_API_KEY_CHECK=True
- MAX_WORKERS=1
depends_on:
db: