all repos — homestead @ 1caa6ea1d70b2171ef2e1f2d82d9f17257898389

Code for my website

provision storage outside of builder

Alan Pearce
commit

1caa6ea1d70b2171ef2e1f2d82d9f17257898389

parent

101ecb319b557b168d109364f4c5503781e8ca79

1 file changed, 8 insertions(+), 17 deletions(-)

changed files
M internal/builder/builder.gointernal/builder/builder.go
@@ -2,7 +2,6 @@ package builder
import ( "context" - "database/sql" "fmt" "io" "os"
@@ -16,7 +15,6 @@ "go.alanpearce.eu/website/internal/config"
"go.alanpearce.eu/website/internal/content" "go.alanpearce.eu/website/internal/sitemap" "go.alanpearce.eu/website/internal/storage" - "go.alanpearce.eu/website/internal/storage/sqlite" "go.alanpearce.eu/website/internal/vcs" "go.alanpearce.eu/website/templates" "go.alanpearce.eu/x/log"
@@ -26,11 +24,12 @@ "gitlab.com/tozd/go/errors"
) type Options struct { - Source string `conf:"default:.,short:s,flag:src"` - Development bool `conf:"default:false,flag:dev"` - VCSRemoteURL config.URL `conf:"default:https://git.alanpearce.eu/website"` - DB *sql.DB `conf:"-"` - Repo *vcs.Repository `conf:"-"` + Source string `conf:"default:.,short:s,flag:src"` + Development bool `conf:"default:false,flag:dev"` + VCSRemoteURL config.URL `conf:"default:https://git.alanpearce.eu/website"` + + Storage storage.Writer `conf:"-"` + Repo *vcs.Repository `conf:"-"` } type Result struct {
@@ -63,7 +62,6 @@ return nil
} func build( - storage storage.Writer, options *Options, config *config.Config, log *log.Logger,
@@ -71,6 +69,7 @@ ) (*Result, error) {
ctx := context.TODO() buf := new(buffer.Buffer) joinSource := joinSourcePath(options.Source) + storage := options.Storage r := &Result{ Hashes: make([]string, 0),
@@ -281,13 +280,5 @@ cfg.EnableGoatCounter = !options.Development
templates.Init() - var storage storage.Writer - storage, err := sqlite.NewWriter(options.DB, log.Named("storage"), &sqlite.Options{ - Compress: true, - }) - if err != nil { - return nil, errors.WithMessage(err, "could not create storage writer") - } - - return build(storage, options, cfg, log) + return build(options, cfg, log) }