From 5559e0134382a141f5edabdacf1dc81f12b55c27 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 15 Apr 2023 21:35:06 +0200 Subject: Implement asset.Loader This moved a bunch of logic out of http and into the asset package, making it available for gmit too. --- src/cmd/mediocre-blog/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/cmd') diff --git a/src/cmd/mediocre-blog/main.go b/src/cmd/mediocre-blog/main.go index aff0f8e..ee09f92 100644 --- a/src/cmd/mediocre-blog/main.go +++ b/src/cmd/mediocre-blog/main.go @@ -101,7 +101,13 @@ func main() { defer postSQLDB.Close() postStore := post.NewStore(postSQLDB) + postAssetStore := asset.NewStore(postSQLDB) + + postAssetLoader := asset.NewStoreLoader(postAssetStore) + postAssetLoader = asset.NewArchiveLoader(postAssetLoader) + postAssetLoader = asset.NewImageLoader(postAssetLoader) + postDraftStore := post.NewDraftStore(postSQLDB) cache := cache.New(5000) @@ -111,6 +117,7 @@ func main() { httpParams.PowManager = powMgr httpParams.PostStore = postStore httpParams.PostAssetStore = postAssetStore + httpParams.PostAssetLoader = postAssetLoader httpParams.PostDraftStore = postDraftStore httpParams.MailingList = ml httpParams.GeminiPublicURL = gmiParams.PublicURL @@ -132,7 +139,7 @@ func main() { gmiParams.Logger = logger.WithNamespace("gmi") gmiParams.Cache = cache gmiParams.PostStore = postStore - gmiParams.PostAssetStore = postAssetStore + gmiParams.PostAssetLoader = postAssetLoader gmiParams.HTTPPublicURL = httpParams.PublicURL logger.Info(ctx, "starting gmi api") -- cgit v1.2.3