Fix routing to get rid of the awkward symlink dereferencing on build
This commit is contained in:
parent
64984d49d6
commit
ef4d5c3bb9
|
@ -25,10 +25,6 @@ has been used.
|
|||
|
||||
### Building
|
||||
- clone or download the repo
|
||||
- `static/html/index.html` is symlinked to `coils` and `registers`
|
||||
for development purposes, the symlinks need to be dereferenced before
|
||||
building the binary on filesystems that support symlinks
|
||||
- Replace symlinks with copies of the files or use e.g. `tar -h`
|
||||
- Build for the correct architecture, e.g. for Linux 32-bit ARM (Rpi Zero W 1):
|
||||
```
|
||||
cd /path/to/repo
|
||||
|
|
11
build.sh
11
build.sh
|
@ -12,15 +12,4 @@ ARCH=${1:-"amd64"}
|
|||
|
||||
VERSION=$(grep -e 'version.*=' main.go | awk '{print $3}' | tr -d '"')
|
||||
|
||||
[[ ! -d "TMP" ]] && mkdir -p TMP
|
||||
|
||||
pushd TMP &> /dev/null || exit 1
|
||||
|
||||
tar --exclude ../TMP -ch ../* | tar xf -
|
||||
|
||||
#env GOOS=linux GOARCH=arm go build -o ../BUILD/enervent-ctrl-${VERSION}.linux-arm32 .
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH="$ARCH" go build -o "../BUILD/enervent-ctrl-${VERSION}.linux-$ARCH" .
|
||||
|
||||
rm -rf ./*
|
||||
|
||||
popd &> /dev/null || exit 1
|
||||
|
|
4
main.go
4
main.go
|
@ -25,7 +25,7 @@ import (
|
|||
var static embed.FS
|
||||
|
||||
var (
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
device pingvin.Pingvin
|
||||
config Conf
|
||||
usernamehash [32]byte
|
||||
|
@ -64,6 +64,8 @@ func serve(cert, key *string) {
|
|||
}
|
||||
htmlroot := http.FileServer(http.FS(html))
|
||||
http.HandleFunc("/", authHandler(htmlroot))
|
||||
http.HandleFunc("/coils/", authHandler(http.StripPrefix("/coils/", htmlroot)))
|
||||
http.HandleFunc("/registers/", authHandler(http.StripPrefix("/registers/", htmlroot)))
|
||||
logdst, err := os.OpenFile(os.DevNull, os.O_WRONLY, os.ModeAppend)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../index.html
|
|
@ -1 +0,0 @@
|
|||
../index.html
|
Loading…
Reference in New Issue