Realtive URL fix
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -72,6 +72,9 @@ logs/
|
||||
*.temp
|
||||
.cache/
|
||||
|
||||
# Generated config files
|
||||
web/config.js
|
||||
|
||||
# Coverage reports
|
||||
htmlcov/
|
||||
.coverage
|
||||
|
||||
@@ -7,7 +7,6 @@ services:
|
||||
# FastAPI Backend
|
||||
api:
|
||||
build: ./backend
|
||||
container_name: ppr_prod_api
|
||||
restart: always
|
||||
environment:
|
||||
DB_HOST: ${DB_HOST}
|
||||
@@ -56,7 +55,6 @@ services:
|
||||
# Redis for caching (optional)
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: ppr_prod_redis
|
||||
restart: always
|
||||
networks:
|
||||
- app_network
|
||||
@@ -69,15 +67,11 @@ services:
|
||||
# Nginx web server for public frontend
|
||||
web:
|
||||
image: nginx:alpine
|
||||
container_name: ppr_prod_web
|
||||
restart: always
|
||||
environment:
|
||||
BASE_URL: ${BASE_URL}
|
||||
command: >
|
||||
sh -c "cp /usr/share/nginx/html/ppr.html /tmp/ppr.html.orig &&
|
||||
sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /tmp/ppr.html.orig > /usr/share/nginx/html/ppr.html &&
|
||||
cp /usr/share/nginx/html/index.html /tmp/index.html.orig &&
|
||||
sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /tmp/index.html.orig > /usr/share/nginx/html/index.html &&
|
||||
sh -c "echo 'window.PPR_CONFIG = { apiBase: \"'\$BASE_URL'/api/v1\" };' > /usr/share/nginx/html/config.js &&
|
||||
nginx -g 'daemon off;'"
|
||||
ports:
|
||||
- "${WEB_PORT_EXTERNAL}:80"
|
||||
|
||||
@@ -49,6 +49,25 @@ services:
|
||||
- private_network
|
||||
- public_network
|
||||
|
||||
# Nginx web server for public frontend
|
||||
web:
|
||||
image: nginx:alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
BASE_URL: ${BASE_URL}
|
||||
command: >
|
||||
sh -c "echo 'window.PPR_CONFIG = { apiBase: \"'\$BASE_URL'/api/v1\" };' > /usr/share/nginx/html/config.js &&
|
||||
nginx -g 'daemon off;'"
|
||||
ports:
|
||||
- "${WEB_PORT_EXTERNAL}:80"
|
||||
volumes:
|
||||
- ./web:/usr/share/nginx/html
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
- api
|
||||
networks:
|
||||
- public_network
|
||||
|
||||
# Redis for caching (optional for now)
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
@@ -57,29 +76,6 @@ services:
|
||||
networks:
|
||||
- private_network
|
||||
|
||||
# Nginx web server for public frontend
|
||||
web:
|
||||
image: nginx:alpine
|
||||
container_name: ppr_nextgen_web
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
BASE_URL: ${BASE_URL}
|
||||
command: >
|
||||
sh -c "sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /usr/share/nginx/html/ppr.html > /tmp/ppr.html &&
|
||||
mv /tmp/ppr.html /usr/share/nginx/html/ppr.html &&
|
||||
sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /usr/share/nginx/html/index.html > /tmp/index.html &&
|
||||
mv /tmp/index.html /usr/share/nginx/html/index.html &&
|
||||
nginx -g 'daemon off;'"
|
||||
ports:
|
||||
- "${WEB_PORT_EXTERNAL}:80" # Public web interface
|
||||
volumes:
|
||||
- ./web:/usr/share/nginx/html
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
depends_on:
|
||||
- api
|
||||
networks:
|
||||
- public_network
|
||||
|
||||
# phpMyAdmin for database management
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
|
||||
13
web/ppr.html
13
web/ppr.html
@@ -441,9 +441,18 @@
|
||||
<!-- Success Notification -->
|
||||
<div id="notification" class="notification"></div>
|
||||
|
||||
<script src="/config.js"></script>
|
||||
<script>
|
||||
// API base URL for iframe embedding
|
||||
const API_BASE = 'https://ppr.swansea-airport.wales/api/v1';
|
||||
// API base URL for iframe embedding - loaded from config.js or fallback
|
||||
console.log('=== PPR Config Debug ===');
|
||||
console.log('window.PPR_CONFIG:', window.PPR_CONFIG);
|
||||
console.log('window.PPR_CONFIG.apiBase:', window.PPR_CONFIG?.apiBase);
|
||||
|
||||
const API_BASE = (window.PPR_CONFIG && window.PPR_CONFIG.apiBase) || '/api/v1';
|
||||
|
||||
console.log('Final API_BASE:', API_BASE);
|
||||
console.log('Source:', window.PPR_CONFIG?.apiBase ? 'config.js' : 'fallback');
|
||||
console.log('=======================');
|
||||
|
||||
// Iframe resizing functionality
|
||||
function sendHeightToParent() {
|
||||
|
||||
Reference in New Issue
Block a user