fix: route prd dashboard data APIs to report service
This commit is contained in:
parent
782ded05e9
commit
fac17de021
@ -4,6 +4,25 @@ metadata:
|
||||
name: imes-basic-dashboard-nginx-conf
|
||||
namespace: prd
|
||||
data:
|
||||
patch_dynamic_sql.py: |
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
patterns = [
|
||||
(re.compile(r'headers:\{data:([A-Za-z_$][\w$]*),"Content-Type":"application/json"\},data:\1'),
|
||||
r'headers:{"Content-Type":"application/json"},data:{crypto:\1,param:""}'),
|
||||
(re.compile(r'headers:\{"Content-Type":"application/json",data:([A-Za-z_$][\w$]*)\},data:\1'),
|
||||
r'headers:{"Content-Type":"application/json"},data:{crypto:\1,param:""}'),
|
||||
]
|
||||
|
||||
for path in Path('/app/www/js').glob('*.js'):
|
||||
text = path.read_text(errors='ignore')
|
||||
updated = text
|
||||
for pattern, replacement in patterns:
|
||||
updated = pattern.sub(replacement, updated)
|
||||
if updated != text:
|
||||
path.write_text(updated)
|
||||
|
||||
web.conf: |
|
||||
server {
|
||||
listen 80;
|
||||
@ -42,6 +61,22 @@ data:
|
||||
proxy_pass http://mom-gateway:9999/rpt/dashboard/visual/detail;
|
||||
}
|
||||
|
||||
location /api/db/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://mom-gateway:9999/rpt/dashboard/db/;
|
||||
}
|
||||
|
||||
location /api/category/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-real-ip $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://mom-gateway:9999/rpt/dashboard/category/;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
@ -132,6 +167,7 @@ spec:
|
||||
for i in $(seq 1 30); do
|
||||
if [ -d /app/nginx/conf.d ]; then
|
||||
cp /dashboard-nginx-conf/web.conf /app/nginx/conf.d/web.conf
|
||||
python3 /dashboard-nginx-conf/patch_dynamic_sql.py || true
|
||||
/app/nginx/sbin/nginx -s reload -c /app/nginx/conf/nginx.conf || true
|
||||
exit 0
|
||||
fi
|
||||
@ -160,5 +196,7 @@ spec:
|
||||
items:
|
||||
- key: web.conf
|
||||
path: web.conf
|
||||
- key: patch_dynamic_sql.py
|
||||
path: patch_dynamic_sql.py
|
||||
name: imes-basic-dashboard-nginx-conf
|
||||
name: dashboard-nginx-conf
|
||||
|
||||
Loading…
Reference in New Issue
Block a user