-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: override network through env variables after build
- Loading branch information
Showing
6 changed files
with
44 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
!.postcssrc.js | ||
!babel.config.js | ||
!vue.config.js | ||
!docker/nginx.conf | ||
!docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ -z $VUE_APP_NETWORK_NAME ] | ||
then | ||
echo Skipping network override because VUE_APP_NETWORK_NAME is not defined | ||
exit | ||
fi | ||
|
||
for name in VUE_APP_NODE_URL VUE_APP_MIDDLEWARE_URL VUE_APP_EXPLORER_URL VUE_APP_COMPILER_URL | ||
do | ||
value=$(eval echo \$$name) | ||
if [ -z $value ] | ||
then | ||
echo Expected $name to be defined | ||
exit 1 | ||
fi | ||
done | ||
|
||
script=" | ||
window.overrideNetwork = { | ||
name: '$VUE_APP_NETWORK_NAME', | ||
url: '$VUE_APP_NODE_URL', | ||
middlewareUrl: '$VUE_APP_MIDDLEWARE_URL', | ||
explorerUrl: '$VUE_APP_EXPLORER_URL', | ||
compilerUrl: '$VUE_APP_COMPILER_URL', | ||
}; | ||
" | ||
script=$(echo $script | tr '\n' ' ') | ||
|
||
cat /usr/share/nginx/html/index.template.html \ | ||
| sed -e "s|// global configuration placeholder|$script|" \ | ||
> /usr/share/nginx/html/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters