Add LITESTREAM_CONFIG env var

This commit is contained in:
Ben Johnson
2021-01-13 13:17:38 -07:00
parent 57a02a8628
commit a42f83f3cb
13 changed files with 117 additions and 185 deletions

View File

@@ -1,7 +1,6 @@
package litestream
import (
"compress/gzip"
"database/sql"
"encoding/binary"
"errors"
@@ -264,24 +263,6 @@ func isHexChar(ch rune) bool {
return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')
}
// gzipReadCloser wraps gzip.Reader to also close the underlying reader on close.
type gzipReadCloser struct {
r *gzip.Reader
closer io.ReadCloser
}
func (r *gzipReadCloser) Read(p []byte) (n int, err error) {
return r.r.Read(p)
}
func (r *gzipReadCloser) Close() error {
if err := r.r.Close(); err != nil {
r.closer.Close()
return err
}
return r.closer.Close()
}
// createFile creates the file and attempts to set the UID/GID.
func createFile(filename string, uid, gid int) (*os.File, error) {
f, err := os.Create(filename)