Skip to content

Commit 320b524

Browse files
committed
Avoid the need to update the path to the runtime-config.js #840
1 parent 82532a3 commit 320b524

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
- You may also have to update imports of `Utils` or other constants.
3232
Most imports have moved to stac-js.
3333
For example, `Utils.isObject` is now `isObject` and can be imported from `stac-js/src/utils.js`.
34+
- It is not needed any longer to update the path to the `runtime-config.js`, the `pathPrefix` is added automatically in the build process.
3435

3536
### Deprecated
3637

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG pathPrefix="/"
22

3-
FROM node:lts-alpine3.18 AS build-step
3+
FROM node:lts-alpine AS build-step
44
ARG DYNAMIC_CONFIG=true
55
ARG historyMode="history"
66
ARG pathPrefix
@@ -11,7 +11,7 @@ WORKDIR /app
1111
COPY package*.json ./
1212
RUN npm install
1313
COPY . .
14-
RUN \[ "${DYNAMIC_CONFIG}" == "true" \] && sed -i "s|<!-- <script defer=\"defer\" src=\"/runtime-config.js\"></script> -->|<script defer=\"defer\" src=\"${pathPrefix}runtime-config.js\"></script>|g" index.html
14+
RUN \[ "${DYNAMIC_CONFIG}" == "true" \] && sed -i 's/<!--RC //;s/ RC-->//' index.html
1515
RUN npm run build
1616

1717

docs/options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following ways to set config options are possible:
1010
- Set **environment variables**, all options need a `SB_` prefix.
1111
So you could for example set the catalog URL via the environment variable `SB_catalogUrl`.
1212
- Optionally, you can also set options after the build, basically **at "runtime"**.
13-
Enable this by removing the `<!--` and `-->` around the `<script defer="defer" src="./runtime-config.js"></script>` in the [`index.html`](../index.html).
13+
Enable this by removing the `<!--RC` and `RC-->` around the `script` tag that loads the `runtime-config.js` in the [`index.html`](../index.html).
1414
Then run the build procedure and after completion, you can fill the `dist/runtime-config.js` with any options that you want to customize.
1515

1616
> [!CAUTION]

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<meta name="og:description" id="og-description" content="">
1212
<meta name="og:locale" id="og-locale" content="en">
1313
<meta name="og:site_name" content="<%- catalogTitle %>">
14-
<!-- <script defer="defer" src="/runtime-config.js"></script> -->
14+
<!--RC <script defer="defer" src="<%- pathPrefix %>runtime-config.js"></script> RC-->
1515
<title><%- catalogTitle %></title>
1616
</head>
1717
<body>

0 commit comments

Comments
 (0)