Skip to content

Commit

Permalink
task: WIP | Fixing .env issue
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmf94 committed Jun 11, 2024
1 parent 553e24d commit e9d5892
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN yarn --network-timeout 600000 --frozen-lockfile

COPY ./frontend ./

RUN rm -rf .env
# RUN rm -rf .env

RUN yarn build

Expand All @@ -28,6 +28,9 @@ RUN wget -O golang-migrate.deb https://github.com/golang-migrate/migrate/release
# Install Poetry
RUN pip install poetry

# Copy th environment file
COPY .env ./backend/app/.env

# Set the working directory
WORKDIR /backend

Expand Down
12 changes: 11 additions & 1 deletion backend/app/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
from app.ingest import ingest_blob
from app.parsing import MIMETYPE_BASED_PARSER

from dotenv import load_dotenv
import os

#dotenv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '.env'))
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
load_dotenv(dotenv_path)


def _guess_mimetype(file_name: str, file_bytes: bytes) -> str:
"""Guess the mime-type of a file based on its name or bytes."""
Expand Down Expand Up @@ -146,7 +153,7 @@ def invoke(self, blob: Blob, config: Optional[RunnableConfig] = None) -> List[st

PG_CONNECTION_STRING = PGVector.connection_string_from_db_params(
driver="psycopg2",
host=os.environ["POSTGRES_HOST"],
host="postgres",#os.environ["POSTGRES_HOST"],
port=int(os.environ["POSTGRES_PORT"]),
database=os.environ["POSTGRES_DB"],
user=os.environ["POSTGRES_USER"],
Expand All @@ -170,3 +177,6 @@ def invoke(self, blob: Blob, config: Optional[RunnableConfig] = None) -> List[st
name="Thread ID",
),
)

if __name__ == "__main__":
print("dotenv_path: ", dotenv_path)
1 change: 1 addition & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ python-json-logger = "^2.0.7"
pulumi = "^3.117.0"
pulumi-aws = "^6.37.1"
pulumi-docker = "^4.5.4"
python-dotenv = "^1.0.1"

[tool.poetry.group.dev.dependencies]
uvicorn = "^0.23.2"
Expand Down

0 comments on commit e9d5892

Please sign in to comment.