chibisafe_netstorage_middleman : restore Dockerfile
This commit is contained in:
parent
898e621610
commit
fab89c56e5
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM golang:latest
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
EXPOSE 4040
|
||||||
|
|
||||||
|
CMD ["go", "run", "main.go"]
|
6
main.go
6
main.go
@ -92,19 +92,15 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
Chibisafe_basepath := os.Getenv("CHIBISAFE_BASEPATH")
|
Chibisafe_basepath := os.Getenv("CHIBISAFE_BASEPATH")
|
||||||
Host := os.Getenv("HOST")
|
|
||||||
|
|
||||||
if Chibisafe_basepath == "" {
|
if Chibisafe_basepath == "" {
|
||||||
log.Fatal("CHIBISAFE_BASEPATH environment is not set!")
|
log.Fatal("CHIBISAFE_BASEPATH environment is not set!")
|
||||||
}
|
}
|
||||||
if Host == "" {
|
|
||||||
Host = "127.0.0.1:4000"
|
|
||||||
}
|
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/api/v1/upload", uploadHandler)
|
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)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user