From 3e22083182e37b115230c490c3bcc8de7d92c5bb Mon Sep 17 00:00:00 2001 From: DutchEllie Date: Fri, 27 May 2022 20:35:53 +0200 Subject: [PATCH 1/4] Made generating static site possible --- Makefile | 3 +++ src/main.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index a9ea487..0ed0a90 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/main.go b/src/main.go index b2c6250..01bfbd5 100644 --- a/src/main.go +++ b/src/main.go @@ -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) From bc3775f77d73088c243c9dec168bff499e1f9d2c Mon Sep 17 00:00:00 2001 From: DutchEllie Date: Fri, 27 May 2022 20:50:12 +0200 Subject: [PATCH 2/4] Possibly maybe.... --- .drone/helm/staging-val.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone/helm/staging-val.yaml b/.drone/helm/staging-val.yaml index b464915..5a8345c 100644 --- a/.drone/helm/staging-val.yaml +++ b/.drone/helm/staging-val.yaml @@ -11,6 +11,7 @@ ingress: external-dns.alpha.kubernetes.io/hostname: "staging.quenten.nl" nginx.ingress.kubernetes.io/configuration-snippet: | add_header Content-Security-Policy "frame-ancestors 'self' https://forestofunix.xyz"; + add_header X-Ipfs-Path /ipfs/bafybeidmv6rn3qiwluntzruqbt5hs5gmnphm4u2nwfv6rcd3zp45lnltxi/ proxy_hide_header X-Frame-Options ; tls: - hosts: From 0fc2c8da7999d51f094097570759547a0c6287b2 Mon Sep 17 00:00:00 2001 From: DutchEllie Date: Fri, 27 May 2022 20:51:53 +0200 Subject: [PATCH 3/4] Possibly maybe.... --- .drone/helm/staging-val.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone/helm/staging-val.yaml b/.drone/helm/staging-val.yaml index 5a8345c..a07db3f 100644 --- a/.drone/helm/staging-val.yaml +++ b/.drone/helm/staging-val.yaml @@ -11,7 +11,7 @@ ingress: external-dns.alpha.kubernetes.io/hostname: "staging.quenten.nl" nginx.ingress.kubernetes.io/configuration-snippet: | add_header Content-Security-Policy "frame-ancestors 'self' https://forestofunix.xyz"; - add_header X-Ipfs-Path /ipfs/bafybeidmv6rn3qiwluntzruqbt5hs5gmnphm4u2nwfv6rcd3zp45lnltxi/ + add_header X-Ipfs-Path /ipfs/bafybeidmv6rn3qiwluntzruqbt5hs5gmnphm4u2nwfv6rcd3zp45lnltxi/; proxy_hide_header X-Frame-Options ; tls: - hosts: From 3a33c86a354f748a7a9beb7dfffcce2e9d5f68ec Mon Sep 17 00:00:00 2001 From: DutchEllie Date: Fri, 27 May 2022 21:30:49 +0200 Subject: [PATCH 4/4] Nah nvm --- .drone/helm/staging-val.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone/helm/staging-val.yaml b/.drone/helm/staging-val.yaml index a07db3f..b464915 100644 --- a/.drone/helm/staging-val.yaml +++ b/.drone/helm/staging-val.yaml @@ -11,7 +11,6 @@ ingress: external-dns.alpha.kubernetes.io/hostname: "staging.quenten.nl" nginx.ingress.kubernetes.io/configuration-snippet: | add_header Content-Security-Policy "frame-ancestors 'self' https://forestofunix.xyz"; - add_header X-Ipfs-Path /ipfs/bafybeidmv6rn3qiwluntzruqbt5hs5gmnphm4u2nwfv6rcd3zp45lnltxi/; proxy_hide_header X-Frame-Options ; tls: - hosts: