Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert envs #272

Merged
merged 1 commit into from
Aug 30, 2024
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
1 change: 0 additions & 1 deletion docker/Dockerfile.aws.lambda
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}" -U --no-cach

# Set NLTK_DATA to load nltk_data
ENV NLTK_DATA=/opt/nltk_data
ENV ENV=production

CMD ["python", "main.py"]
1 change: 0 additions & 1 deletion docker/Dockerfile.subscriber
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ RUN pip install -r requirements.txt

# Copy function code
COPY . ${LAMBDA_TASK_ROOT}
ENV ENV=production
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "handler.lambda_handler" ]
8 changes: 2 additions & 6 deletions petercat_utils/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
import os

def load_env():
env = os.getenv("ENV", "development")
print(f"load_env={env}")
load_dotenv(verbose=True, override=True)

if env == 'development':
load_dotenv(dotenv_path=".env.local", verbose=True, override=True)
load_dotenv(verbose=True, override=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the ENV variable and its conditional logic might lead to issues if different environments require different configurations. Consider adding a fallback or ensuring that the .env.local file is suitable for all environments.

load_dotenv(dotenv_path=".env.local", verbose=True, override=True)

load_env()

Expand Down