Moved API URL to environment
This commit is contained in:
parent
734d9e4e27
commit
ba1fae4547
@ -16,8 +16,6 @@ steps:
|
|||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: dutchellie/proper-website-2
|
repo: dutchellie/proper-website-2
|
||||||
build_args:
|
|
||||||
- APIURL=https://api.quenten.nl/api/testing
|
|
||||||
tags:
|
tags:
|
||||||
- dev
|
- dev
|
||||||
- ${DRONE_COMMIT_SHA:0:8}
|
- ${DRONE_COMMIT_SHA:0:8}
|
||||||
@ -64,8 +62,6 @@ steps:
|
|||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: dutchellie/proper-website-2
|
repo: dutchellie/proper-website-2
|
||||||
build_args:
|
|
||||||
- APIURL=https://api.quenten.nl/api
|
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- ${DRONE_COMMIT_SHA:0:8}
|
- ${DRONE_COMMIT_SHA:0:8}
|
||||||
|
@ -31,5 +31,9 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
containerPort: 8000
|
containerPort: 8000
|
||||||
|
{{- if .Values.containerEnv }}
|
||||||
|
env: {{ toYaml .Values.containerEnv | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6,6 +6,7 @@ podAnnotations: {}
|
|||||||
containerName: newsite
|
containerName: newsite
|
||||||
image: dutchellie/proper-website-2:latest
|
image: dutchellie/proper-website-2:latest
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
|
containerEnv: []
|
||||||
|
|
||||||
service:
|
service:
|
||||||
name: newsite-service
|
name: newsite-service
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
name: newsite-prod
|
name: newsite-prod
|
||||||
|
containerEnv:
|
||||||
|
- name: APIURL
|
||||||
|
value: https://api.quenten.nl/api
|
||||||
service:
|
service:
|
||||||
name: newsite-prod
|
name: newsite-prod
|
||||||
ingress:
|
ingress:
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
name: newsite-staging
|
name: newsite-staging
|
||||||
|
containerEnv:
|
||||||
|
- name: APIURL
|
||||||
|
value: https://api.quenten.nl/api/testing
|
||||||
service:
|
service:
|
||||||
name: newsite-staging
|
name: newsite-staging
|
||||||
ingress:
|
ingress:
|
||||||
|
@ -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 -ldflags="-X 'main.ApiURL=$APIURL'" ./src
|
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
|
||||||
RUN go build -o app -ldflags="-X 'main.ApiURL=$APIURL'" ./src
|
RUN go build -o app ./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
|
||||||
|
@ -10,10 +10,6 @@ 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
|
||||||
}
|
}
|
||||||
|
@ -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"
|
||||||
@ -15,7 +16,15 @@ import (
|
|||||||
// collection *mongo.Collection
|
// collection *mongo.Collection
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ApiURL string
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
ApiURL = os.Getenv("APIURL")
|
||||||
|
if ApiURL == "" {
|
||||||
|
log.Fatalln("Unable to get API URL from environment variables!")
|
||||||
|
}
|
||||||
homepage := NewHomepage()
|
homepage := NewHomepage()
|
||||||
aboutpage := NewAboutPage()
|
aboutpage := NewAboutPage()
|
||||||
galaxiespage := NewGalaxiesPage()
|
galaxiespage := NewGalaxiesPage()
|
||||||
|
Loading…
Reference in New Issue
Block a user