Revert APIURL changes, it's impossible
continuous-integration/drone/push Build is passing Details

This commit is contained in:
DutchEllie 2022-05-14 20:45:28 +02:00
parent 450bf3631c
commit a88651e4b7
Signed by: DutchEllie
SSH Key Fingerprint: SHA256:dKq6ZSgN5E3Viqrw/+xAdf2VdR6hdRGNyrYqXXwfjTY
4 changed files with 15 additions and 14 deletions

View File

@ -3,8 +3,8 @@ ARG APIURL
WORKDIR /project WORKDIR /project
ADD . /project/ ADD . /project/
RUN go mod tidy RUN go mod tidy
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm ./src RUN GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=$APIURL'" ./src
RUN go build -o app ./src RUN go build -o app -ldflags="-X 'main.ApiURL=$APIURL'" ./src
FROM alpine:latest AS staging FROM alpine:latest AS staging
RUN apk --no-cache add ca-certificates RUN apk --no-cache add ca-certificates

View File

@ -1,10 +1,14 @@
APIURL_prod := https://api.nicecock.eu/api APIURL_prod := https://api.quenten.nl/api
APIURL_staging := https://api.nicecock.eu/api/testing 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
build-new:
GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
go build -o app ./src
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
@ -12,5 +16,8 @@ build-prod:
run: build run: build
./app ./app
run-new: build-new
APIURL=${APIURL_staging} ./app
run-prod: build-prod run-prod: build-prod
./app ./app

View File

@ -10,6 +10,10 @@ import (
"github.com/maxence-charriere/go-app/v9/pkg/app" "github.com/maxence-charriere/go-app/v9/pkg/app"
) )
var (
ApiURL string
)
type Homepage struct { type Homepage struct {
app.Compo app.Compo
} }

View File

@ -4,7 +4,6 @@ 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"
@ -16,10 +15,6 @@ import (
// collection *mongo.Collection // collection *mongo.Collection
//} //}
var (
ApiURL string
)
func main() { func main() {
homepage := NewHomepage() homepage := NewHomepage()
aboutpage := NewAboutPage() aboutpage := NewAboutPage()
@ -40,11 +35,6 @@ func main() {
// It exits immediately on the server side // It exits immediately on the server side
app.RunWhenOnBrowser() app.RunWhenOnBrowser()
ApiURL = os.Getenv("APIURL")
if ApiURL == "" {
log.Fatalln("Unable to get API URL from environment variables!")
}
icon := &app.Icon{ icon := &app.Icon{
Default: "/web/static/images/icon-small.png", Default: "/web/static/images/icon-small.png",
Large: "/web/static/images/icon.png", Large: "/web/static/images/icon.png",