This commit is contained in:
parent
db41f565ca
commit
6822cd6bfe
@ -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"]
|
@ -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 {
|
||||
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)
|
||||
}
|
||||
defer f.Close()
|
||||
cfg, err := gpaste.ServerConfigFromReader(f)
|
||||
if err != nil {
|
||||
return cli.Exit(err, 1)
|
||||
}
|
||||
}
|
||||
// Setup loggers
|
||||
rootLogger := getRootLogger(cfg.LogLevel)
|
||||
|
Loading…
Reference in New Issue
Block a user