From fab89c56e51121972dee26400864b0f0c46046ba Mon Sep 17 00:00:00 2001 From: minoplhy Date: Wed, 10 Apr 2024 01:00:48 +0700 Subject: [PATCH] chibisafe_netstorage_middleman : restore Dockerfile --- Dockerfile | 11 +++++++++++ main.go | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5040ac6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:latest + +WORKDIR /app + +COPY . . + +RUN go mod download + +EXPOSE 4040 + +CMD ["go", "run", "main.go"] diff --git a/main.go b/main.go index 700b8e2..bb1d81e 100644 --- a/main.go +++ b/main.go @@ -92,19 +92,15 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) { func main() { Chibisafe_basepath := os.Getenv("CHIBISAFE_BASEPATH") - Host := os.Getenv("HOST") if Chibisafe_basepath == "" { log.Fatal("CHIBISAFE_BASEPATH environment is not set!") } - if Host == "" { - Host = "127.0.0.1:4000" - } mux := http.NewServeMux() mux.HandleFunc("/api/v1/upload", uploadHandler) - if err := http.ListenAndServe(Host, mux); err != nil { + if err := http.ListenAndServe(":4040", mux); err != nil { log.Fatal(err) } }