Skip to content
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
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Multi-stage build for database schema spec generator
# Stage 1: Build the schemas
FROM alpine:3.22.1 AS builder

# Install Python, uv, and git (needed for some dependencies)
RUN apk add --no-cache python3 py3-pip git

# Install uv package manager
RUN pip3 install --break-system-packages uv
FROM ghcr.io/astral-sh/uv:0.8.13-alpine3.22 AS builder

# Set working directory
WORKDIR /app
Expand All @@ -27,7 +21,7 @@ COPY .env ./
RUN uv run python main.py

# Stage 2: Final lightweight image with only the output
FROM alpine:3.22.1
FROM alpine:3.22 AS final

# Create output directory
RUN mkdir -p /output
Expand Down
10 changes: 0 additions & 10 deletions database_schema_spec/core/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Configuration constants for the database schema spec generator."""

import os
from pathlib import Path

from dotenv import load_dotenv
from pydantic import BaseModel, Field, ValidationError
from pydantic_settings import BaseSettings

Expand Down Expand Up @@ -67,12 +65,6 @@ class Config(BaseSettings):
def __init__(self, **data):
"""Initialize config with custom error handling for missing required fields."""
try:
# Enforce presence of required env variables in the process environment
# before delegating to BaseSettings. This ensures tests that clear os.environ
# see the expected ConfigurationError.
if "base_url" not in data and "BASE_URL" not in os.environ:
raise ConfigurationError(variable_name="BASE_URL")

super().__init__(**data)
except ValidationError as e:
# Only handle missing field errors, let other validation errors bubble up
Expand All @@ -88,6 +80,4 @@ def __init__(self, **data):
raise


# At application import time, populate os.environ from .env (if present), then enforce presence.
load_dotenv(override=True)
config = Config()
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies = [
"jsonschema>=4.25.0",
"pydantic>=2.11.7",
"pydantic-settings>=2.10.1",
"python-dotenv>=1.1.1",
]

[dependency-groups]
Expand Down
4 changes: 1 addition & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.