From 67a818c17b5b9288352aa08d018b191c64fd5611 Mon Sep 17 00:00:00 2001 From: Johnny Bouder Date: Tue, 19 Aug 2025 20:30:25 -0400 Subject: [PATCH 1/3] Update settings to support optional configs. Move default database from .env to settings. Update readme. --- README.md | 4 ++-- app/config.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e051ed3..3f21a87 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ pip install . pip install -e ".[dev]" ``` -4. To prepare your environment, add a file called `.env` to the `comet-api` directory. Copy and paste the template below and replace the placeholder values with your own: +4. To override default environment variables, add a file called `.env` to the `comet-api` directory and update as needed (optional): ``` -DATABASE_URL=[SOME_URL] # Ex: 'sqlite:///./db.sqlite3' +DATABASE_URL=[SOME_URL] # Ex: 'postgresql://username:password@localhost:5432/database_name' OIDC_CONFIG_URL=[SOME_URL] # Ex: 'https://token.actions.githubusercontent.com/.well-known/openid-configuration' ``` diff --git a/app/config.py b/app/config.py index 6e44c9d..effb554 100644 --- a/app/config.py +++ b/app/config.py @@ -4,8 +4,8 @@ class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env") - DATABASE_URL: str - OIDC_CONFIG_URL: str + DATABASE_URL: str | None = "sqlite:///./db.sqlite3" + OIDC_CONFIG_URL: str | None = None settings = Settings() From 86b4daba70aa5d9052b85092799f7b3a653aa281 Mon Sep 17 00:00:00 2001 From: Johnny Bouder Date: Tue, 19 Aug 2025 20:31:40 -0400 Subject: [PATCH 2/3] Remove .env from dockerfile. Remove vars from code quality workflow. --- .github/workflows/code-quality.yaml | 4 ---- Dockerfile | 1 - 2 files changed, 5 deletions(-) diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml index 1b015f1..08ea655 100644 --- a/.github/workflows/code-quality.yaml +++ b/.github/workflows/code-quality.yaml @@ -10,10 +10,6 @@ on: permissions: contents: read -env: - DATABASE_URL: ${{ vars.DATABASE_URL }} - OIDC_CONFIG_URL: ${{ vars.OIDC_CONFIG_URL }} - jobs: build: runs-on: ubuntu-latest diff --git a/Dockerfile b/Dockerfile index e21c0d4..3d77d2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,5 @@ COPY . . RUN pip install . COPY ./app /code/app -COPY ./.env /code/.env CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "5000"] From d5c76b7efdfdafbfee81ecaaa97e206937eb28d6 Mon Sep 17 00:00:00 2001 From: Johnny Bouder Date: Wed, 20 Aug 2025 08:42:45 -0400 Subject: [PATCH 3/3] Remove none type from database url as setting is required. --- app/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config.py b/app/config.py index effb554..d5f69ed 100644 --- a/app/config.py +++ b/app/config.py @@ -4,7 +4,7 @@ class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env") - DATABASE_URL: str | None = "sqlite:///./db.sqlite3" + DATABASE_URL: str = "sqlite:///./db.sqlite3" OIDC_CONFIG_URL: str | None = None