From 8eb7ad213e0d209d35ba2ec90dcaf878d9d800ed Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Tue, 25 Jul 2023 16:11:42 -0700 Subject: [PATCH] development flag in ansible role for redirecting to webpack dev server --- client/package.json | 2 +- roles/chatbridge/defaults/main.yml | 4 ++++ roles/chatbridge/templates/nginx_chatbridge_http.conf.j2 | 8 ++++++++ server/src/services/groupConfig.service.ts | 6 +++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client/package.json b/client/package.json index 9c9e788..0d2f34c 100644 --- a/client/package.json +++ b/client/package.json @@ -14,7 +14,7 @@ "web-vitals": "^2.1.4" }, "scripts": { - "start": "NODE_ENV=development webpack serve -c ./config/webpack.dev.js --mode development", + "start": "NODE_ENV=development webpack -c ./config/webpack.dev.js --mode development", "build": "NODE_ENV=production webpack --config ./config/webpack.prod.js", "test": "react-scripts test", "eject": "react-scripts eject" diff --git a/roles/chatbridge/defaults/main.yml b/roles/chatbridge/defaults/main.yml index a259f2d..9aa0601 100644 --- a/roles/chatbridge/defaults/main.yml +++ b/roles/chatbridge/defaults/main.yml @@ -1,5 +1,9 @@ --- # defaults file for chatbridge +CHATBRIDGE_MODE: development + +# development options +chatbridge_webpack_port: 8080 chatbridge_postgres_user: chatbridge chatbridge_postgres_password: CHANGEME diff --git a/roles/chatbridge/templates/nginx_chatbridge_http.conf.j2 b/roles/chatbridge/templates/nginx_chatbridge_http.conf.j2 index 3578418..448065c 100644 --- a/roles/chatbridge/templates/nginx_chatbridge_http.conf.j2 +++ b/roles/chatbridge/templates/nginx_chatbridge_http.conf.j2 @@ -7,6 +7,13 @@ server { proxy_pass http://127.0.0.1:{{ chatbridge_api_port }}/; } + {% if CHATBRIDGE_MODE == "development" %} + location {{ chatbridge_webroot }}/ { + proxy_pass http://127.0.0.1:{{ chatbridge_webpack_port }}/; + } + + {% else %} + location {{ chatbridge_webroot }} { root {{ chatbridge_user_home }}/public; try_files $uri $uri/ $uri/index.html /index.html index.html; @@ -17,5 +24,6 @@ server { root {{ chatbridge_user_home }}/public; try_files $uri $uri/ $uri/index.html =404; } + {% endif %} } diff --git a/server/src/services/groupConfig.service.ts b/server/src/services/groupConfig.service.ts index a4a6776..f80f5e5 100644 --- a/server/src/services/groupConfig.service.ts +++ b/server/src/services/groupConfig.service.ts @@ -6,6 +6,6 @@ import {Group} from "../entities/group.entity"; import {AppDataSource} from "../db/data-source"; -export const updateGroup = async(name:string){ - -} \ No newline at end of file +// export const updateGroup = async(name:string){ +// +// }