Skip to content

Commit 27c41ce

Browse files
committed
feat: support setting default NGSI_URL during build
1 parent 959a536 commit 27c41ce

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ module.exports = {
55
'es6': true,
66
'node': false
77
},
8+
'globals': {
9+
'process': true
10+
},
811
'plugins': [
912
'react'
1013
],

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM node:18-alpine as build
22

3+
ARG NGSI_URL
4+
ENV NGSI_URL $NGSI_URL
5+
36
WORKDIR /usr/src/app
47

58
# Install app dependencies

app/components/AddEntities.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import { addAlertAnimationToSource } from '../lib/ol-alert-animation';
1313
import { setSpecialLayerStyle } from '../lib/ol-layer-style';
1414

1515
export default function AddEntities() {
16-
1716
const [show, setShow] = useState(false);
1817
const handleClose = () => setShow(false);
1918
const handleShow = () => setShow(true);
2019

21-
const [url, setUrl] = useState('http://localhost:2026');
20+
const [url, setUrl] = useState(process.env.NGSI_URL || 'http://localhost:1026');
2221
const handleUrlChanged = (e) => {
2322
e.preventDefault();
2423
setUrl(e.target.value);

docker-compose.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
services:
33
app:
4-
build: ./
4+
build:
5+
context: .
6+
args:
7+
- NGSI_URL=http://localhost:2026
58
ports:
69
- "1234:80"

0 commit comments

Comments
 (0)