Moved API URL to environment
This commit is contained in:
		
							parent
							
								
									3a50e68071
								
							
						
					
					
						commit
						082487fab7
					
				@ -16,8 +16,6 @@ steps:
 | 
			
		||||
    password:
 | 
			
		||||
      from_secret: docker_password
 | 
			
		||||
    repo: dutchellie/proper-website-2
 | 
			
		||||
    build_args:
 | 
			
		||||
      - APIURL=https://api.quenten.nl/api/testing
 | 
			
		||||
    tags: 
 | 
			
		||||
      - dev
 | 
			
		||||
      - ${DRONE_COMMIT_SHA:0:8}
 | 
			
		||||
@ -64,8 +62,6 @@ steps:
 | 
			
		||||
    password: 
 | 
			
		||||
      from_secret: docker_password
 | 
			
		||||
    repo: dutchellie/proper-website-2
 | 
			
		||||
    build_args:
 | 
			
		||||
      - APIURL=https://api.quenten.nl/api
 | 
			
		||||
    tags: 
 | 
			
		||||
      - latest
 | 
			
		||||
      - ${DRONE_COMMIT_SHA:0:8}
 | 
			
		||||
 | 
			
		||||
@ -31,5 +31,9 @@ spec:
 | 
			
		||||
          ports:
 | 
			
		||||
            - name: http
 | 
			
		||||
              containerPort: 8000
 | 
			
		||||
        {{- if .Values.containerEnv }}
 | 
			
		||||
          env: {{ toYaml .Values.containerEnv | nindent 12 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      
 | 
			
		||||
@ -6,6 +6,7 @@ podAnnotations: {}
 | 
			
		||||
containerName: newsite
 | 
			
		||||
image: dutchellie/proper-website-2:latest
 | 
			
		||||
imagePullPolicy: Always
 | 
			
		||||
containerEnv: []
 | 
			
		||||
 | 
			
		||||
service:
 | 
			
		||||
  name: newsite-service
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,7 @@
 | 
			
		||||
name: newsite-prod
 | 
			
		||||
containerEnv:
 | 
			
		||||
  - name: APIURL
 | 
			
		||||
    value: https://api.quenten.nl/api
 | 
			
		||||
service:
 | 
			
		||||
  name: newsite-prod
 | 
			
		||||
ingress:
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,7 @@
 | 
			
		||||
name: newsite-staging
 | 
			
		||||
containerEnv:
 | 
			
		||||
  - name: APIURL
 | 
			
		||||
    value: https://api.quenten.nl/api/testing
 | 
			
		||||
service:
 | 
			
		||||
  name: newsite-staging
 | 
			
		||||
ingress:
 | 
			
		||||
 | 
			
		||||
@ -3,8 +3,8 @@ ARG APIURL
 | 
			
		||||
WORKDIR /project
 | 
			
		||||
ADD . /project/
 | 
			
		||||
RUN go mod tidy
 | 
			
		||||
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=$APIURL'" ./src
 | 
			
		||||
RUN	go build -o app -ldflags="-X 'main.ApiURL=$APIURL'" ./src
 | 
			
		||||
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm ./src
 | 
			
		||||
RUN	go build -o app ./src
 | 
			
		||||
 | 
			
		||||
FROM alpine:latest AS staging
 | 
			
		||||
RUN apk --no-cache add ca-certificates
 | 
			
		||||
 | 
			
		||||
@ -10,10 +10,6 @@ import (
 | 
			
		||||
	"github.com/maxence-charriere/go-app/v9/pkg/app"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	ApiURL string
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Homepage struct {
 | 
			
		||||
	app.Compo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"compress/gzip"
 | 
			
		||||
	"log"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"github.com/gorilla/handlers"
 | 
			
		||||
	"github.com/maxence-charriere/go-app/v9/pkg/app"
 | 
			
		||||
@ -15,7 +16,15 @@ import (
 | 
			
		||||
//	collection *mongo.Collection
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	ApiURL string
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	ApiURL = os.Getenv("APIURL")
 | 
			
		||||
	if ApiURL == "" {
 | 
			
		||||
		log.Fatalln("Unable to get API URL from environment variables!")
 | 
			
		||||
	}
 | 
			
		||||
	homepage := NewHomepage()
 | 
			
		||||
	aboutpage := NewAboutPage()
 | 
			
		||||
	galaxiespage := NewGalaxiesPage()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user