Merge branch 'main' of dutchellie.nl:DutchEllie/proper-website-2
continuous-integration/drone/push Build is passing Details

This commit is contained in:
DutchEllie 2022-05-31 09:48:21 +02:00
commit 67358d1616
Signed by: DutchEllie
SSH Key Fingerprint: SHA256:dKq6ZSgN5E3Viqrw/+xAdf2VdR6hdRGNyrYqXXwfjTY
2 changed files with 7 additions and 0 deletions

View File

@ -4,14 +4,17 @@ APIURL_staging := https://api.quenten.nl/api/testing
build:
GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=${APIURL_staging}'" ./src
go build -o app -ldflags="-X 'main.ApiURL=${APIURL_staging}'" ./src
cp -r web staticsite/
build-new:
GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
go build -o app ./src
cp -r web staticsite/
build-prod:
GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=${APIURL_prod}'" ./src
go build -o app -ldflags="-X 'main.ApiURL=${APIURL_prod}'" ./src
cp -r web staticsite/
run: build
./app

View File

@ -4,6 +4,7 @@ import (
"compress/gzip"
"log"
"net/http"
"os"
"github.com/gorilla/handlers"
"github.com/maxence-charriere/go-app/v9/pkg/app"
@ -89,6 +90,9 @@ func main() {
app.GenerateStaticWebsite("./staticsite", handler)
compressed := handlers.CompressHandlerLevel(handler, gzip.BestSpeed)
http.Handle("/", compressed)
if os.Getenv("GEN_STATIC_SITE") == "true" {
return
}
if err := http.ListenAndServe(":8000", nil); err != nil {
log.Fatal(err)