Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c32453
Add nginx and dual domain setup
kolok Aug 11, 2023
15b908b
fix merge conflict
fabienheureux Mar 18, 2025
bafee66
fix precommit issue
fabienheureux Mar 18, 2025
25342b8
Make nginx work
fabienheureux Mar 19, 2025
80f452f
Merge remote-tracking branch 'origin/main' into improve-dual-domain-s…
fabienheureux Mar 19, 2025
152ed19
Test things
fabienheureux Mar 19, 2025
a642466
???
fabienheureux Mar 19, 2025
43bcff5
???
fabienheureux Mar 19, 2025
53a58eb
More dynamic playwright approach
fabienheureux Mar 20, 2025
0b6a893
wip
fabienheureux Mar 20, 2025
c9bfdf2
Add nginx
fabienheureux Mar 20, 2025
e4e5c17
a single url...
fabienheureux Mar 20, 2025
fa29871
Fix a test
fabienheureux Mar 20, 2025
78a94f0
deprecate legacy urls
fabienheureux Mar 20, 2025
04d1298
wip
fabienheureux Mar 20, 2025
8b971be
Run all test suite
fabienheureux Mar 20, 2025
3c34e09
wip
fabienheureux Mar 20, 2025
0d740b1
fix unit tests
fabienheureux Mar 20, 2025
8c7bc67
Remove useless test
fabienheureux Mar 20, 2025
ea3dec2
hum hum
fabienheureux Mar 20, 2025
973fb87
oopsy
fabienheureux Mar 20, 2025
9886d30
oopsy
fabienheureux Mar 20, 2025
eefd374
oopsy
fabienheureux Mar 20, 2025
9f5c703
Disable test for now
fabienheureux Mar 20, 2025
aeb3881
Presque fini
fabienheureux Mar 20, 2025
8f77d27
Merge remote-tracking branch 'origin/main' into improve-dual-domain-s…
fabienheureux Apr 22, 2025
12e0f5b
Rename url in header html
fabienheureux Apr 22, 2025
b73b762
rename context processsor
fabienheureux Apr 22, 2025
ad2cc47
wip
fabienheureux Apr 22, 2025
58650a5
remove useless change
fabienheureux Apr 22, 2025
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
15 changes: 7 additions & 8 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
AIRFLOW_CONN_QFDMO_DJANGO_DB=postgresql+psycopg2://qfdmo:qfdmo@localhost:6543/qfdmo
AIRFLOW_WEBSERVER_REFRESHACTEUR_URL=http://localhost:8080
ALLOWED_HOSTS=localhost,127.0.0.1
AIRFLOW_WEBSERVER_REFRESHACTEUR_URL=https://lvao.ademe.local
AWS_ACCESS_KEY_ID=
AWS_S3_ENDPOINT_URL='https://s3.fr-par.scw.cloud'
AWS_S3_REGION_NAME='fr-par'
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME='qfdmo-interface'
BASE_URL=http://localhost:8000
CMS_BASE_URL=https://longuevieauxobjets.ademe.fr
CARTE_MAX_SOLUTION_DISPLAYED=10
CONN_MAX_AGE=0
CORS_ALLOWED_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
DATABASE_URL=postgis://qfdmo:qfdmo@localhost:6543/qfdmo
DB_READONLY=postgis://qfdmo:qfdmo@localhost:6543/qfdmo
DEBUG=True
Expand All @@ -26,8 +22,11 @@ STIMULUS_DEBUG=false
POSTHOG_DEBUG=false
ASSISTANT_MATOMO_ID=82
ASSISTANT_POSTHOG_KEY=phc_fSfhoWDOUxZdKWty16Z3XfRiAoWd1qdJK0N0z9kQHJr # [DEV] project
ASSISTANT_HOSTS=localhost:8000
ASSISTANT_BASE_URL=http://localhost:8000
NOTION_TOKEN=
NOTION_CONTACT_FORM_DATABASE_ID=17c6523d57d78140b87f000cd3ecef4b # Correspond à https://www.notion.so/accelerateur-transition-ecologique-ademe/17c6523d57d7808b8cc5f5ccae264f7c?v=17c6523d57d78140b87f000cd3ecef4b&pvs=4
DATA_UPLOAD_MAX_NUMBER_FIELDS=10000
DATA_UPLOAD_MAX_NUMBER_FIELDS=10000

BASE_URL=https://quefairedemesdechets.ademe.local
CMS_BASE_URL=https://longuevieauxobjets.ademe.fr
ASSISTANT_HOSTS=quefairedemesdechets.ademe.local
ALLOWED_HOSTS=lvao.ademe.local,quefairedemesdechets.ademe.local
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: "Intégration continue"

on:
pull_request:
types: [labeled, opened, synchronize]
workflow_dispatch:

defaults:
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:

e2e:
runs-on: ubuntu-latest
if: contains(join(github.event.pull_request.labels.*.name, ','), 'frontend')
strategy:
matrix:
shard: [1/5, 2/5, 3/5, 4/5, 5/5]
Expand All @@ -96,6 +97,14 @@ jobs:
- 6543:5432
steps:
- uses: actions/checkout@v4

- name: Prepare environment
run: |
cp .env.template .env
echo BASE_URL=http://localhost:8000 >> .env
echo ALLOWED_HOSTS=localhost >> .env
echo ASSISTANT_HOSTS=localhost >> .env

- uses: actions/setup-node@v4
with:
node-version-file: ".tool-versions"
Expand Down Expand Up @@ -125,9 +134,6 @@ jobs:
- name: Install the project dependencies
run: poetry sync --with dev --no-root

- name: Set env variables
run: cp .env.template .env

- name: Migrate database
run: |
poetry run python manage.py createcachetable
Expand All @@ -146,10 +152,3 @@ jobs:

- name: Run Playwright tests
run: npx playwright test --reporter=list --update-snapshots --shard=${{ matrix.shard }}

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ media

_build
.obsidian
*.pem
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"filename": "core/settings.py",
"hashed_secret": "1ee34e26aeaf89c64ecc2c85efe6a961b75a50e9",
"is_verified": false,
"line_number": 218
"line_number": 275
}
],
"dbt/package-lock.yml": [
Expand All @@ -156,7 +156,7 @@
"filename": "docker-compose.yml",
"hashed_secret": "3cf2012487b086bba2adb3386d69c2ab67a268b6",
"is_verified": false,
"line_number": 55
"line_number": 60
}
],
"iframe_without_js.html": [
Expand Down Expand Up @@ -187,5 +187,5 @@
}
]
},
"generated_at": "2025-04-16T15:04:57Z"
"generated_at": "2025-04-22T10:11:19Z"
}
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ PYTHON := poetry run python
DJANGO_ADMIN := $(PYTHON) manage.py
PYTEST := poetry run pytest
DB_URL := postgres://qfdmo:qfdmo@localhost:6543/qfdmo# pragma: allowlist secret
ASSISTANT_URL := quefairedemesdechets.ademe.local
LVAO_URL := lvao.ademe.local

# Makefile config
.PHONY: check
Expand All @@ -17,6 +19,10 @@ check:
@npm --version
@node --version

.PHONY: init-certs
init-certs:
docker run -ti -v ./nginx-local-only/certs:/app/certs -w /app/certs --rm alpine/mkcert $(LVAO_URL) $(ASSISTANT_URL)


.PHONY: init-dev
init-dev:
Expand All @@ -26,6 +32,7 @@ init-dev:
# python
curl -sSL https://install.python-poetry.org | python3 -
poetry install --with dev,airflow
make init-certs
# javascript
npm install
npx playwright install --with-deps
Expand All @@ -50,7 +57,6 @@ run-airflow:

.PHONY: run-django
run-django:
docker compose --profile lvao up -d
rm -rf .parcel-cache
honcho start -f Procfile.dev

Expand Down Expand Up @@ -100,7 +106,7 @@ unit-test:

.PHONY: e2e-test
e2e-test:
npx playwright test
npx playwright test --ui
$(PYTEST) ./integration_tests

.PHONY: a11y
Expand Down
16 changes: 11 additions & 5 deletions core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,24 @@ def content(request):
return vars(constants)


def assistant(request) -> dict:
if request.META.get("HTTP_HOST") not in settings.ASSISTANT["HOSTS"]:
return {}

return {
def global_context(request) -> dict:
base = {
"assistant": {
"is_home": request.path == reverse("home"),
"is_iframe": request.COOKIES.get("iframe") == "1"
or "iframe" in request.GET,
"POSTHOG_KEY": settings.ASSISTANT["POSTHOG_KEY"],
"MATOMO_ID": settings.ASSISTANT["MATOMO_ID"],
"BASE_URL": settings.ASSISTANT["BASE_URL"],
},
"lvao": {"BASE_URL": settings.ASSISTANT["BASE_URL"]},
}

if request.META.get("HTTP_HOST") not in settings.ASSISTANT["HOSTS"]:
return base

return {
**base,
"footer_pages": CMSPage.objects.all(),
"search_form": SearchForm(),
"search_view_template_name": SEARCH_VIEW_TEMPLATE_NAME,
Expand Down
Loading
Loading