Add mechanism for bundling UI assets. (#153)

* Add mechanism for bundling UI assets.

The scripts/uigen.sh script will check out the UI repo, build assets,
create a static assets file, and clean up.

The dev Makefile target has been modified to run this script if no
assets file is found. There is also a build-ui target that will
unilaterally update (the dev target only builds if the file isn't found,
but doesn't update).

The handler has been updated to add the default org ID as a header if
the request path is "/".

Co-authored-by: Randall Morey <randall@randallmorey.com>
This commit is contained in:
Jeff MitchellandRandall Morey authored and GitHub committed 2020-06-30 11:26:22 -04:00
1 parent 8d8bb42418
commit 8da4effd5e
10 files changed
+147 -65

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
set -e
origdir=$(pwd)
tempdir=$(mktemp -d update-ui-assets.XXXXXX)
ui_commitish=${UI_COMMITISH:-develop}
cd $tempdir
git clone https://github.com/hashicorp/watchtower-ui
cd watchtower-ui
git fetch origin ${ui_commitish}
git checkout ${ui_commitish}
docker-compose -f docker-compose-embedding.yml run build
cd $origdir
go-bindata -fs -o internal/ui/assets.go -pkg ui -prefix "${origdir}/${tempdir}/watchtower-ui/ui/core/dist" "${origdir}/${tempdir}/watchtower-ui/ui/core/dist"
rm -rf $tempdir