Made generating static site possible
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8aaecbab69
commit
029b426757
3
Makefile
3
Makefile
|
@ -4,14 +4,17 @@ APIURL_staging := https://api.quenten.nl/api/testing
|
||||||
build:
|
build:
|
||||||
GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=${APIURL_staging}'" ./src
|
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
|
go build -o app -ldflags="-X 'main.ApiURL=${APIURL_staging}'" ./src
|
||||||
|
cp -r web staticsite/
|
||||||
|
|
||||||
build-new:
|
build-new:
|
||||||
GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
|
GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
|
||||||
go build -o app ./src
|
go build -o app ./src
|
||||||
|
cp -r web staticsite/
|
||||||
|
|
||||||
build-prod:
|
build-prod:
|
||||||
GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=${APIURL_prod}'" ./src
|
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
|
go build -o app -ldflags="-X 'main.ApiURL=${APIURL_prod}'" ./src
|
||||||
|
cp -r web staticsite/
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
./app
|
./app
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
"github.com/maxence-charriere/go-app/v9/pkg/app"
|
"github.com/maxence-charriere/go-app/v9/pkg/app"
|
||||||
|
@ -89,6 +90,9 @@ func main() {
|
||||||
app.GenerateStaticWebsite("./staticsite", handler)
|
app.GenerateStaticWebsite("./staticsite", handler)
|
||||||
compressed := handlers.CompressHandlerLevel(handler, gzip.BestSpeed)
|
compressed := handlers.CompressHandlerLevel(handler, gzip.BestSpeed)
|
||||||
http.Handle("/", compressed)
|
http.Handle("/", compressed)
|
||||||
|
if os.Getenv("GEN_STATIC_SITE") == "true" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := http.ListenAndServe(":8000", nil); err != nil {
|
if err := http.ListenAndServe(":8000", nil); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue