From 46888530b2321280cd7e6a240a18bdbfb96da330 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sun, 3 Apr 2022 09:09:50 -0600 Subject: [PATCH] Default upstream path if not specified --- cmd/litestream/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/litestream/main.go b/cmd/litestream/main.go index bc75bf8..d6d145e 100644 --- a/cmd/litestream/main.go +++ b/cmd/litestream/main.go @@ -309,10 +309,12 @@ func NewDBFromConfigWithPath(dbc *DBConfig, path string) (*litestream.DB, error) // Attach upstream HTTP client if specified. if upstreamURL := dbc.Upstream.URL; upstreamURL != "" { - if dbc.Upstream.Path == "" { - return nil, fmt.Errorf("upstream path required") + // Use local database path if upstream path is not specified. + upstreamPath := dbc.Upstream.Path + if upstreamPath == "" { + upstreamPath = db.Path() } - db.StreamClient = http.NewClient(upstreamURL, dbc.Upstream.Path) + db.StreamClient = http.NewClient(upstreamURL, upstreamPath) } // Override default database settings if specified in configuration.