Skip to content

Commit

Permalink
Fixing computed field issue
Browse files Browse the repository at this point in the history
  • Loading branch information
caparker committed Jun 11, 2024
1 parent 68ecd22 commit 0b2144a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ingest/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class Settings(BaseSettings):
DATABASE_DB: str
DATABASE_HOST: str
DATABASE_PORT: int
DATABASE_READ_URL: Union[str, None]
DATABASE_WRITE_URL: Union[str, None]
DRYRUN: bool = False
FETCH_BUCKET: str
ETL_BUCKET: str
Expand All @@ -35,14 +33,14 @@ class Settings(BaseSettings):

@computed_field
def DATABASE_READ_URL(self) -> str:
return f"postgresql://{values['DATABASE_READ_USER']}:{values['DATABASE_READ_PASSWORD']}@{values['DATABASE_HOST']}:{values['DATABASE_PORT']}/{values['DATABASE_DB']}"
return f"postgresql://{self.DATABASE_READ_USER}:{self.DATABASE_READ_PASSWORD}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_DB}"

@computed_field
def DATABASE_WRITE_URL(self) -> str:
return f"postgresql://{values['DATABASE_WRITE_USER']}:{values['DATABASE_WRITE_PASSWORD']}@{values['DATABASE_HOST']}:{values['DATABASE_PORT']}/{values['DATABASE_DB']}"
return f"postgresql://{self.DATABASE_WRITE_USER}:{self.DATABASE_WRITE_PASSWORD}@{self.DATABASE_HOST}:{self.DATABASE_PORT}/{self.DATABASE_DB}"

model_config = SettingsConfigDict(
extra="ignore", env_file=f"../{environ.get('DOTENV', '.env')}", env_file_encoding="utf-8"
extra="ignore", env_file=f"{environ.get('DOTENV', '.env')}", env_file_encoding="utf-8"
)


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pydantic-settings = "^2.3.2"

[tool.poetry.group.cdk.dependencies]
aws-cdk-lib = "^2.145.0"
boto3 = "^1.34.124"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit 0b2144a

Please sign in to comment.