Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit c46df43

Browse files
authored
Merge pull request #35 from cjellick/main
Fix superfluous WriteHeader
2 parents 21602ab + 0040d69 commit c46df43

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ jobs:
2222
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
2323
- name: Build and push acorn
2424
run: |
25-
acorn build --platform linux/amd64 --platform linux/arm64 -t ghcr.io/acorn-io/acorn-dns:$TAG .
25+
acorn build --platform linux/amd64 --platform linux/arm64 -t ghcr.io/acorn-io/acorn-dns:$TAG . --tag=$TAG
2626
acorn push ghcr.io/acorn-io/acorn-dns:$TAG

Acornfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@ args: {
77

88
// The AWS Route53 zone where FQDNs will be created
99
route53ZoneId: ""
10+
11+
// The tag that should be displayed in version information
12+
tag: "v0.0.0-dev"
1013
}
1114

1215
containers: {
1316
default: {
1417
dependsOn: "db"
1518
build: {
19+
buildArgs: {
20+
TAG: args.tag
21+
}
1622
context: "."
1723
}
1824
scale: args.scale

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
FROM golang:1.18 AS build
22
COPY / /src
33
WORKDIR /src
4-
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build make build
4+
ARG TAG="v0.0.0-dev"
5+
ENV CGO_ENABLED=0
6+
RUN --mount=type=cache,target=/go/pkg --mount=type=cache,target=/root/.cache/go-build \
7+
go build -o bin/acorn-dns -ldflags "-s -w -X 'github.com/acorn-io/acorn-dns/pkg/version.Tag=${TAG}'" .
58

69
FROM alpine:3.16.1 AS base
710
RUN apk add --no-cache ca-certificates

pkg/apiserver/handlers.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ func newHandler(b backend.Backend) *handler {
2525

2626
func (h *handler) root(w http.ResponseWriter, r *http.Request) {
2727
v := version.Get()
28-
if err := json.NewEncoder(w).Encode(v); err != nil {
29-
w.WriteHeader(500)
30-
_, _ = w.Write([]byte(`{"success": false}`))
31-
}
32-
w.WriteHeader(200)
28+
writeSuccess(w, http.StatusOK, v)
3329
}
3430

3531
func (h *handler) getDomain(w http.ResponseWriter, r *http.Request) {

pkg/apiserver/logging_middleware.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ func loggingMiddleware(logger *logrus.Entry) func(http.Handler) http.Handler {
6969
wrapped := wrapResponseWriter(w)
7070
next.ServeHTTP(wrapped, r)
7171

72-
// Per Shannon Huff 2021-11-20, only log requests if it's not
73-
// a health check request
7472
if !strings.Contains(r.URL.EscapedPath(), "healthz") {
7573
logger.WithFields(logrus.Fields{
7674
"status": wrapped.status,

0 commit comments

Comments
 (0)