Skip to content

Commit

Permalink
Merge pull request #30 from a-luna:fix-gh-action-deploy_attempt-16
Browse files Browse the repository at this point in the history
Update Dockerfile and API settings
  • Loading branch information
a-luna authored Jan 8, 2024
2 parents 38f2f4d + 066ede9 commit 072e326
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 15 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.11
FROM python:3.
SHELL ["/bin/bash", "-c"]

ARG ENV
ARG UNICODE_VERSION
Expand All @@ -23,6 +24,19 @@ ENV RATE_LIMIT_BURST=${RATE_LIMIT_BURST}
ENV TEST_HEADER=${TEST_HEADER}

WORKDIR /code

RUN echo $'ENV=${ENV}\n\
PYTHONPATH=.\n\
UNICODE_VERSION=${UNICODE_VERSION}\n\
REDIS_HOST=${REDIS_HOST}\n\
REDIS_PORT=${REDIS_PORT}\n\
REDIS_DB=${REDIS_DB}\n\
REDIS_PW=${REDIS_PW}\n\
RATE_LIMIT_PER_PERIOD=${RATE_LIMIT_PER_PERIOD}\n\
RATE_LIMIT_PERIOD_SECONDS=${RATE_LIMIT_PERIOD_SECONDS}\n\
RATE_LIMIT_BURST=${RATE_LIMIT_BURST}\n\
TEST_HEADER=${TEST_HEADER}' > /code/.env

RUN pip install -U pip setuptools wheel
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions app/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logging
import os

from app.config.api_settings import UnicodeApiSettings, get_dev_settings, get_prod_settings, get_test_settings
from app.config.api_settings import UnicodeApiSettings, get_api_settings, get_test_settings


def get_settings() -> UnicodeApiSettings:
env = os.environ.get("ENV", "DEV")
settings = get_test_settings() if "TEST" in env else get_prod_settings() if "PROD" in env else get_dev_settings()
settings = get_test_settings() if "TEST" in env else get_api_settings()
logger = logging.getLogger("app.api")
logger.debug(settings.api_settings_report)
logger.debug(settings.rate_limit_settings_report)
Expand Down
2 changes: 1 addition & 1 deletion app/config/api_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def get_prod_settings() -> UnicodeApiSettings: # pragma: no cover
return UnicodeApiSettings(**settings)


def get_dev_settings() -> UnicodeApiSettings: # pragma: no cover
def get_api_settings() -> UnicodeApiSettings: # pragma: no cover
env_vars = read_dotenv_file(DOTENV_FILE)
settings = {
"ENV": env_vars.get("ENV", "DEV"),
Expand Down

0 comments on commit 072e326

Please sign in to comment.