Simple Go module to embed litestream replication in your Go project.
Adapted from example
go get github.com/jinjie/lsembed
// ...
replica := litestream.NewReplica(
litestream.NewDB(app.DataDir()+"/data.db"),
"s3",
)
replica.Client = &s3.ReplicaClient{
AccessKeyID: "ACCESSKEY",
SecretAccessKey: "SECRETKEY",
Bucket: "litestream-test-bucket",
Region: "ap-southeast-1",
Path: "path",
}
lsdb, err := lsembed.Replicate(replica)
if err != nil {
log.Fatal().Err(err).Msg("failed to replicate")
}
defer lsdb.Close()
//..