From cffe06cf1973c1e47aa83a23b5843756440e80ba Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Tue, 18 Jun 2024 13:24:51 -0300 Subject: [PATCH] Update tox configuration. --- tox.ini | 15 ++++++++------- virtual_library_card/settings/dev.py | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/tox.ini b/tox.ini index af95573..bc74885 100644 --- a/tox.ini +++ b/tox.ini @@ -13,9 +13,6 @@ docker = docker: db-vlc docker: minio-vlc setenv = - docker: VLC_DEV_DB_HOST=localhost - docker: VLC_DEV_DB_PORT=9010 - docker: VLC_DEV_AWS_S3_ENDPOINT_URL=http://localhost:9011 COVERAGE_FILE = .coverage.{envname} allowlist_externals = poetry @@ -35,8 +32,10 @@ environment = POSTGRES_USER=vlc POSTGRES_PASSWORD=test POSTGRES_DB=test_virtual_library_card_dev -ports = - 9010:5432/tcp +expose = + VLC_DEV_DB_PORT=5432/tcp +host_var = + VLC_DEV_DB_HOST healthcheck_cmd = pg_isready healthcheck_interval = 5 healthcheck_retries = 10 @@ -47,8 +46,10 @@ environment = MINIO_ACCESS_KEY=vlc-minio MINIO_SECRET_KEY=123456789 MINIO_DEFAULT_BUCKETS=vlc-test:download -ports = - 9011:9000/tcp +expose = + VLC_DEV_AWS_S3_ENDPOINT_URL_PORT=9000/tcp +host_var = + VLC_DEV_AWS_S3_ENDPOINT_URL_HOST [gh-actions] python = diff --git a/virtual_library_card/settings/dev.py b/virtual_library_card/settings/dev.py index e437d1b..4ac66dd 100644 --- a/virtual_library_card/settings/dev.py +++ b/virtual_library_card/settings/dev.py @@ -59,9 +59,19 @@ DEFAULT_FILE_STORAGE = "virtual_library_card.storage.S3PublicStorage" STATICFILES_STORAGE = "virtual_library_card.storage.S3StaticStorage" AWS_STORAGE_BUCKET_NAME = "vlc-test" -AWS_S3_ENDPOINT_URL = os.environ.get( - "VLC_DEV_AWS_S3_ENDPOINT_URL", "http://localhost:9000" -) +if "VLC_DEV_AWS_S3_ENDPOINT_URL" in os.environ: + AWS_S3_ENDPOINT_URL = os.environ["VLC_DEV_AWS_S3_ENDPOINT_URL"] +elif ( + "VLC_DEV_AWS_S3_ENDPOINT_URL_HOST" in os.environ + and "VLC_DEV_AWS_S3_ENDPOINT_URL_PORT" in os.environ +): + AWS_S3_ENDPOINT_URL = ( + f"http://{os.environ['VLC_DEV_AWS_S3_ENDPOINT_URL_HOST']}" + f":{os.environ['VLC_DEV_AWS_S3_ENDPOINT_URL_PORT']}" + ) +else: + AWS_S3_ENDPOINT_URL = "http://localhost:9000" + AWS_S3_CUSTOM_DOMAIN = os.environ.get("VLC_DEV_AWS_S3_CUSTOM_DOMAIN", False) AWS_S3_URL_PROTOCOL = os.environ.get("VLC_DEV_AWS_S3_URL_PROTOCOL", "https:")