Skip to content

Commit 7855c68

Browse files
committed
Update | Docker config
1 parent 781e38d commit 7855c68

8 files changed

+19
-33
lines changed

.env .env.docker

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
USE_ENVIRONMENT_CONFIG=true
1+
REACT_APP_USE_ENVIRONMENT_CONFIG=false
2+
REACT_APP_TIMEOUT_SPAN=300000
3+
REACT_APP_APP_ID=admin
24
REACT_APP_LOCALHOST=https://app.cenit.io
35
REACT_APP_CENIT_HOST=https://server.cenit.io
4-
TIMEOUT_SPAN=300000
5-
REACT_APP_APP_ID=admin

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
# misc
1515
.DS_Store
16-
.env.local
17-
.env.development.local
18-
.env.test.local
19-
.env.production.local
16+
.env*
2017

2118
# IDEs and editors
2219
/.idea

Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ COPY package-lock.json .
88
RUN npm install -g npm@latest
99
RUN npm ci --silent
1010
RUN npm install react-scripts --production -g --silent
11-
COPY . .
11+
COPY env.sh .
12+
COPY src src/
13+
COPY public public/
14+
COPY conf conf/
1215
RUN npm run build
1316

1417
# => Run container
@@ -20,6 +23,6 @@ COPY --from=builder /app/build /usr/share/nginx/html/
2023
EXPOSE 80
2124
WORKDIR /usr/share/nginx/html
2225
COPY ./env.sh .
23-
COPY .env .
26+
COPY .env.docker .env
2427
RUN chmod +x env.sh
2528
CMD ["/bin/sh", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ And that's all!
3939
docker run -dti -e REACT_APP_LOCALHOST=http://127.0.0.1:3001 \
4040
-e REACT_APP_CENIT_HOST=http://127.0.0.1:3000 \
4141
-p 3000:80 \
42-
--name container_name ghcr.io/cenit-io/ui:latest
42+
--name cenit-ui ghcr.io/cenit-io/ui:latest
4343
```
4444
Navigate to http://localhost:3000/ in your browser to view the app.

development.md

+3-17
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@
44
This is a React application for the administration of a Cenit Platform instance, that is currently under development.
55
Follow these instructions to configure a local instance of Cenit and connect it as a backend for the app.
66

7-
## Configuring the Admin App
8-
9-
Update public/config.js
10-
11-
```
12-
window.appConfig = {
13-
USE_ENVIRONMENT_CONFIG: "true",
14-
REACT_APP_LOCALHOST: "http://127.0.0.1:3000",
15-
REACT_APP_CENIT_HOST: "http://127.0.0.1:3001",
16-
TIMEOUT_SPAN: "300000",
17-
REACT_APP_APP_ID: "admin",
18-
}
19-
```
20-
217
## Configuring the Backend
228

239
1. Make sure the Cenit **local repository is up to date with the remote**. The developed branch of Cenit
@@ -78,9 +64,9 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
7864
### Run with Docker
7965

8066
```
81-
docker run -dti -e REACT_APP_LOCALHOST=http://127.0.0.1:3001 \
82-
-e REACT_APP_CENIT_HOST=http://127.0.0.1:3000 \
67+
docker run -dti -e REACT_APP_LOCALHOST=http://127.0.0.1:3000 \
68+
-e REACT_APP_CENIT_HOST=http://127.0.0.1:3001 \
8369
-p 3000:80 \
84-
--t cenit-ui:latest
70+
-t cenit-ui:latest
8571
```
8672
Navigate to http://localhost:3000/ in your browser to view the app.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"sortablejs": "^1.12.0"
3939
},
4040
"scripts": {
41-
"start": "chmod +x ./env.sh && ./env.sh && cp config.js ./public/ && react-scripts start",
41+
"start": "react-scripts start",
4242
"build": "react-scripts build",
4343
"test": "react-scripts test",
4444
"eject": "react-scripts eject"

public/config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
window.appConfig = {
2-
USE_ENVIRONMENT_CONFIG: "true",
2+
REACT_APP_USE_ENVIRONMENT_CONFIG: "true",
3+
REACT_APP_TIMEOUT_SPAN: "300000",
4+
REACT_APP_APP_ID: "admin",
35
REACT_APP_LOCALHOST: "https://app.cenit.io",
46
REACT_APP_CENIT_HOST: "https://server.cenit.io",
5-
TIMEOUT_SPAN: "300000",
6-
REACT_APP_APP_ID: "admin",
7-
}
7+
};

src/services/AuthorizationService.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const EnvironmentProcessConfig = {
1919
appIdentifier: process.env.REACT_APP_APP_ID
2020
};
2121

22-
export const Config = AppConfig.USE_ENVIRONMENT_CONFIG == "true" ? EnvironmentAppConfig : EnvironmentProcessConfig;
22+
export const Config = AppConfig.REACT_APP_USE_ENVIRONMENT_CONFIG === 'true' ? EnvironmentProcessConfig : EnvironmentAppConfig;
2323

2424
export const CenitHostKey = 'cenitHost';
2525

0 commit comments

Comments
 (0)