fix: hide credentials in dagster env
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
"""Dagster resources."""
|
"""Dagster resources."""
|
||||||
|
|
||||||
import os
|
from dagster import ConfigurableResource, EnvVar
|
||||||
|
|
||||||
from dagster import ConfigurableResource
|
|
||||||
from funda import Funda
|
from funda import Funda
|
||||||
from sqlalchemy import create_engine, text
|
from sqlalchemy import create_engine, text
|
||||||
|
|
||||||
@@ -19,11 +17,11 @@ class FundaResource(ConfigurableResource):
|
|||||||
class PostgresResource(ConfigurableResource):
|
class PostgresResource(ConfigurableResource):
|
||||||
"""Lightweight Postgres resource for raw ingestion writes."""
|
"""Lightweight Postgres resource for raw ingestion writes."""
|
||||||
|
|
||||||
host: str = os.getenv("POSTGRES_HOST", "localhost")
|
host: str = EnvVar("POSTGRES_HOST")
|
||||||
port: int = int(os.getenv("POSTGRES_PORT", "5432"))
|
port: int = EnvVar.int("POSTGRES_PORT")
|
||||||
user: str = os.getenv("POSTGRES_USER", "")
|
user: str = EnvVar("POSTGRES_USER")
|
||||||
password: str = os.getenv("POSTGRES_PASSWORD", "")
|
password: str = EnvVar("POSTGRES_PASSWORD")
|
||||||
dbname: str = os.getenv("POSTGRES_DB", "")
|
dbname: str = EnvVar("POSTGRES_DB")
|
||||||
|
|
||||||
def get_engine(self):
|
def get_engine(self):
|
||||||
url = f"postgresql://{self.user}:{self.password}@{self.host}:{self.port}/{self.dbname}"
|
url = f"postgresql://{self.user}:{self.password}@{self.host}:{self.port}/{self.dbname}"
|
||||||
|
|||||||
Reference in New Issue
Block a user