From 445eb045fca0f98b3a6b3c81fdc97dd0d9ba5948 Mon Sep 17 00:00:00 2001
From: Etienne LOUPIAS <eloupias@grandlyon.com>
Date: Thu, 30 Mar 2023 09:06:23 +0200
Subject: [PATCH] fix(pwa): move config outside assets to fix serviceworker
 mismatch

---
 angular.json                                | 1 +
 docker-compose.local.yml                    | 2 +-
 docker-compose.yml                          | 2 +-
 src/app/app.module.ts                       | 2 +-
 src/{assets => config}/config.json          | 0
 src/{assets => config}/config.template.json | 0
 6 files changed, 4 insertions(+), 3 deletions(-)
 rename src/{assets => config}/config.json (100%)
 rename src/{assets => config}/config.template.json (100%)

diff --git a/angular.json b/angular.json
index cebdb5d5b..17ca42ce4 100644
--- a/angular.json
+++ b/angular.json
@@ -39,6 +39,7 @@
             "assets": [
               "src/favicon.ico",
               "src/assets",
+              "src/config/config.json",
               "src/sitemap.xml",
               "src/robots.txt",
               "src/ngsw-worker.js",
diff --git a/docker-compose.local.yml b/docker-compose.local.yml
index 3857c5e28..d61b0c35c 100644
--- a/docker-compose.local.yml
+++ b/docker-compose.local.yml
@@ -7,7 +7,7 @@ services:
     image: registry.forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client:${TAG}
     volumes:
       - ./nginx/local.conf:/etc/nginx/conf.d/default.conf
-      - ./src/assets/config.json:/usr/share/nginx/html/assets/config.json
+      - ./src/config/config.json:/usr/share/nginx/html/config/config.json
     ports:
       - 8030:8080
     extra_hosts:
diff --git a/docker-compose.yml b/docker-compose.yml
index 12192986b..8cf8c152a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,6 +6,6 @@ services:
     image: registry.forge.grandlyon.com/web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client:${TAG}
     volumes:
       - ./dev.conf:/etc/nginx/conf.d/default.conf
-      - ./config.json:/usr/share/nginx/html/assets/config.json
+      - ./config.json:/usr/share/nginx/html/config/config.json
     ports:
       - 8030:8080
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 36b35b928..b0caadecb 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -81,7 +81,7 @@ import { StructureJoinComponent } from './structure/structure-join/structure-joi
     ServiceWorkerModule.register('ngsw-worker.js', {
       enabled: environment.production,
     }),
-    RuntimeConfigLoaderModule,
+    RuntimeConfigLoaderModule.forRoot({ configUrl: './config/config.json' }),
     NgxMatomoTrackerModule.forRoot({ mode: MatomoInitializationMode.AUTO_DEFERRED }),
     NgxMatomoRouterModule,
   ],
diff --git a/src/assets/config.json b/src/config/config.json
similarity index 100%
rename from src/assets/config.json
rename to src/config/config.json
diff --git a/src/assets/config.template.json b/src/config/config.template.json
similarity index 100%
rename from src/assets/config.template.json
rename to src/config/config.template.json
-- 
GitLab