Skip to content

Commit

Permalink
separate dev vs test params
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Dec 16, 2024
1 parent 5582faa commit 434171b
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 26 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@ jobs:
runs-on: ubuntu-latest
env:
PYTHONPATH: .
DJANGO_SETTINGS_MODULE: config.settings.base
DJANGO_SECRET_KEY: ministryofsillywalks
DJANGO_SETTINGS_MODULE: config.settings.test

CPUCOUNT: 1
PGPASSWORD: password
PGHOST: localhost
PGUSER: postgres
POSTGRESQL_ADDON_DB: communaute
POSTGRESQL_ADDON_USER: postgres
POSTGRESQL_ADDON_PASSWORD: password
CELLAR_ADDON_KEY_ID: minioadmin
CELLAR_ADDON_KEY_SECRET: minioadmin
CELLAR_ADDON_PROTOCOL: http
CELLAR_ADDON_HOST: localhost:9000
S3_STORAGE_BUCKET_REGION: eu-west-3

services:
minio:
image: bitnami/minio
Expand Down
32 changes: 16 additions & 16 deletions config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@

# Database
# ------------------------------------------------------------------------------
DATABASES["default"]["HOST"] = os.getenv("POSTGRESQL_ADDON_HOST", "127.0.0.1") # noqa F405
DATABASES["default"]["PORT"] = os.getenv("POSTGRESQL_ADDON_PORT", "5432") # noqa F405
DATABASES["default"]["NAME"] = os.getenv("POSTGRESQL_ADDON_DB", "communaute") # noqa F405
DATABASES["default"]["USER"] = os.getenv("POSTGRESQL_ADDON_USER", "communaute") # noqa F405
DATABASES["default"]["PASSWORD"] = os.getenv("POSTGRESQL_ADDON_PASSWORD", "password") # noqa F405
DATABASES["default"]["HOST"] = os.getenv("POSTGRESQL_ADDON_HOST") # noqa F405
DATABASES["default"]["PORT"] = os.getenv("POSTGRESQL_ADDON_PORT") # noqa F405
DATABASES["default"]["NAME"] = os.getenv("POSTGRESQL_ADDON_DB") # noqa F405
DATABASES["default"]["USER"] = os.getenv("POSTGRESQL_ADDON_USER") # noqa F405
DATABASES["default"]["PASSWORD"] = os.getenv("POSTGRESQL_ADDON_PASSWORD") # noqa F405

# ProConnect
# ------------------------------------------------------------------------------
OPENID_CONNECT_BASE_URL = os.getenv("OPENID_CONNECT_BASE_URL", "http://127.0.0.1:8080")
OPENID_CONNECT_CLIENT_ID = os.getenv("OPENID_CONNECT_CLIENT_ID", "local_openid_connect")
OPENID_CONNECT_CLIENT_SECRET = os.getenv("OPENID_CONNECT_CLIENT_SECRET", "password")
OPENID_CONNECT_BASE_URL = os.getenv("OPENID_CONNECT_BASE_URL")
OPENID_CONNECT_CLIENT_ID = os.getenv("OPENID_CONNECT_CLIENT_ID")
OPENID_CONNECT_CLIENT_SECRET = os.getenv("OPENID_CONNECT_CLIENT_SECRET")

# SENDINBLUE / BREVO
# ---------------------------------------
SIB_URL = os.getenv("SIB_URL", "https://test.com")
SIB_URL = os.getenv("SIB_URL")
SIB_SMTP_URL = urljoin(SIB_URL, "smtp/email")
SIB_CONTACTS_URL = urljoin(SIB_URL, "contacts/import")
SIB_API_KEY = os.getenv("SIB_API_KEY", "key_to_be_set")
SIB_API_KEY = os.getenv("SIB_API_KEY")

# Security.
# ------------------------------------------------------------------------------
Expand All @@ -50,12 +50,12 @@
# S3 uploads
# ------------------------------------------------------------------------------

AWS_S3_ACCESS_KEY_ID = os.getenv("CELLAR_ADDON_KEY_ID", "minioadmin")
AWS_S3_SECRET_ACCESS_KEY = os.getenv("CELLAR_ADDON_KEY_SECRET", "minioadmin")
AWS_S3_ENDPOINT_URL = (
f"{os.getenv('CELLAR_ADDON_PROTOCOL', 'http')}://{os.getenv('CELLAR_ADDON_HOST', "localhost:9000")}"
)
AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_STORAGE_BUCKET_REGION", "us-west-3")
AWS_S3_ACCESS_KEY_ID = os.getenv("CELLAR_ADDON_KEY_ID")
AWS_S3_SECRET_ACCESS_KEY = os.getenv("CELLAR_ADDON_KEY_SECRET")
AWS_S3_ENDPOINT_URL = f"{os.getenv('CELLAR_ADDON_PROTOCOL')}://{os.getenv('CELLAR_ADDON_HOST')}"
AWS_STORAGE_BUCKET_NAME = os.getenv("S3_STORAGE_BUCKET_NAME", "private-bucket")
AWS_STORAGE_BUCKET_NAME_PUBLIC = os.getenv("S3_STORAGE_BUCKET_NAME_PUBLIC", "public-bucket")
AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_STORAGE_BUCKET_REGION")

# Django-extensions.
# ------------------------------------------------------------------------------
Expand Down
46 changes: 46 additions & 0 deletions config/settings/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
from urllib.parse import urljoin

from lacommunaute.utils.enums import Environment

from .base import * # pylint: disable=wildcard-import,unused-wildcard-import # noqa: F403 F401


SECRET_KEY = "jumpinjackflash"
DEBUG = False
ENVIRONMENT = Environment.DEV
ALLOWED_HOSTS = []
COMPRESS_ENABLED = False

# Database
# ------------------------------------------------------------------------------
DATABASES["default"]["HOST"] = os.getenv("POSTGRESQL_ADDON_HOST", "127.0.0.1") # noqa F405
DATABASES["default"]["PORT"] = os.getenv("POSTGRESQL_ADDON_PORT", "5432") # noqa F405
DATABASES["default"]["NAME"] = os.getenv("POSTGRESQL_ADDON_DB", "communaute") # noqa F405
DATABASES["default"]["USER"] = os.getenv("POSTGRESQL_ADDON_USER", "communaute") # noqa F405
DATABASES["default"]["PASSWORD"] = os.getenv("POSTGRESQL_ADDON_PASSWORD", "password") # noqa F405

# S3 uploads
# ------------------------------------------------------------------------------

AWS_S3_ACCESS_KEY_ID = os.getenv("CELLAR_ADDON_KEY_ID", "minioadmin")
AWS_S3_SECRET_ACCESS_KEY = os.getenv("CELLAR_ADDON_KEY_SECRET", "minioadmin")
AWS_S3_ENDPOINT_URL = (
f"{os.getenv('CELLAR_ADDON_PROTOCOL', "http")}://{os.getenv('CELLAR_ADDON_HOST', "localhost:9000")}"
)
AWS_STORAGE_BUCKET_NAME = os.getenv("S3_STORAGE_BUCKET_NAME", "private-bucket")
AWS_STORAGE_BUCKET_NAME_PUBLIC = os.getenv("S3_STORAGE_BUCKET_NAME_PUBLIC", "public-bucket")
AWS_S3_STORAGE_BUCKET_REGION = os.getenv("S3_STORAGE_BUCKET_REGION", "eu-west-3")

# ProConnect
# ------------------------------------------------------------------------------
OPENID_CONNECT_BASE_URL = os.getenv("OPENID_CONNECT_BASE_URL", "http://127.0.0.1:8080")
OPENID_CONNECT_CLIENT_ID = os.getenv("OPENID_CONNECT_CLIENT_ID", "local_openid_connect")
OPENID_CONNECT_CLIENT_SECRET = os.getenv("OPENID_CONNECT_CLIENT_SECRET", "password")

# SENDINBLUE / BREVO
# ---------------------------------------
SIB_URL = os.getenv("SIB_URL", "https://test.com")
SIB_SMTP_URL = urljoin(SIB_URL, "smtp/email")
SIB_CONTACTS_URL = urljoin(SIB_URL, "contacts/import")
SIB_API_KEY = os.getenv("SIB_API_KEY", "key_to_be_set")

0 comments on commit 434171b

Please sign in to comment.