diff --git a/Dockerfile b/Dockerfile index a3582b0..7edd6d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM golang:1.20-alpine WORKDIR /usr/src/app -# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change -COPY go.mod index-inlined-minified.html main.go ./ +COPY go.mod index.html main.go ./ +ADD assets ./assets/ RUN go mod download && go mod verify RUN go build -v -o /usr/local/bin/app ./... diff --git a/web/master.css b/assets/master.css similarity index 100% rename from web/master.css rename to assets/master.css diff --git a/web/res/font/Mont-Heavy.otf b/assets/res/font/Mont-Heavy.otf similarity index 100% rename from web/res/font/Mont-Heavy.otf rename to assets/res/font/Mont-Heavy.otf diff --git a/web/res/svg/cloud.svg b/assets/res/svg/cloud.svg similarity index 100% rename from web/res/svg/cloud.svg rename to assets/res/svg/cloud.svg diff --git a/web/res/svg/error-page-overlay.svg b/assets/res/svg/error-page-overlay.svg similarity index 100% rename from web/res/svg/error-page-overlay.svg rename to assets/res/svg/error-page-overlay.svg diff --git a/web/res/svg/rocks.svg b/assets/res/svg/rocks.svg similarity index 100% rename from web/res/svg/rocks.svg rename to assets/res/svg/rocks.svg diff --git a/index-inlined-minified.html b/index-inlined-minified.html deleted file mode 100644 index 1491f90..0000000 --- a/index-inlined-minified.html +++ /dev/null @@ -1 +0,0 @@ - Montehaselino - Automatic Status Response

ERROR

{{.Code}}

{{.Message}}

Go Back
This is an automatically generated error response page.
Please contact administration if you feel this shouldn't be here.
diff --git a/web/page.html b/index.html similarity index 88% rename from web/page.html rename to index.html index f1767d9..0ce92c4 100644 --- a/web/page.html +++ b/index.html @@ -7,14 +7,14 @@ Montehaselino - Automatic Status Response - +
- +

ERROR

{{.Code}}

diff --git a/main.go b/main.go index 02b5099..136c76a 100644 --- a/main.go +++ b/main.go @@ -52,7 +52,7 @@ func genStatus(request string) StatusData { // create and init page status var status StatusData status.Code = "500" - status.Message = fmt.Sprintf("Invalid error response code recieved: %.5s[..]", request) + status.Message = fmt.Sprintf("Invalid error response code recieved: `%.5s`", request) status.Response = 500 // check if we have a valid status code @@ -74,7 +74,7 @@ func genStatus(request string) StatusData { func main() { // load template - tmpl, err := template.ParseFiles("index-inlined-minified.html") + tmpl, err := template.ParseFiles("index.html") if err != nil { log.Fatal(err) } @@ -86,6 +86,9 @@ func main() { tmpl.Execute(w, status) }) + // serve static assets + http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets")))) + var address = fmt.Sprintf("%s:%s", os.Getenv("BIND"), os.Getenv("PORT")) log.Fatal(http.ListenAndServe(address, nil))