From 6822cd6bfefb76300f7503caebd735885cbdfefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Fri, 21 Jan 2022 18:03:49 +0100 Subject: [PATCH] Fix Dockerfile --- Dockerfile | 1 + cmd/server/actions/actions.go | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 344fafe..7e30835 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,5 @@ RUN go build -o gpaste-server ./cmd/server/server.go FROM alpine:latest COPY --from=builder /src/gpaste /bin/gpaste COPY --from=builder /src/gpaste-server /bin/gpaste-server +EXPOSE 8080 CMD ["/bin/gpaste-server"] \ No newline at end of file diff --git a/cmd/server/actions/actions.go b/cmd/server/actions/actions.go index e538605..c70f5f2 100644 --- a/cmd/server/actions/actions.go +++ b/cmd/server/actions/actions.go @@ -2,6 +2,7 @@ package actions import ( "context" + "io" "net/http" "os" "os/signal" @@ -21,14 +22,27 @@ func ActionServe(c *cli.Context) error { configPath = c.String("config") } - f, err := os.Open(configPath) + var cfg *gpaste.ServerConfig + var r io.ReadCloser + r, err := os.Open(configPath) if err != nil { - return cli.Exit(err, 1) - } - defer f.Close() - cfg, err := gpaste.ServerConfigFromReader(f) - if err != nil { - return cli.Exit(err, 1) + cfg = &gpaste.ServerConfig{ + LogLevel: "INFO", + URL: "localhost:8080", + ListenAddr: ":8080", + SigningSecret: "TODO: CHANGE THIS LOL", + Store: &gpaste.ServerStoreConfig{ + Type: "memory", + }, + } + } else { + defer r.Close() + cfg, err = gpaste.ServerConfigFromReader(r) + if err != nil { + if err != nil { + return cli.Exit(err, 1) + } + } } // Setup loggers rootLogger := getRootLogger(cfg.LogLevel)