repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
a8f4b4e
parent
5aa6451
author
Eric Bower
date
2023-11-12 04:29:44 +0000 UTC
chore(script): clean write env var
2 files changed,  +11, -2
M Makefile
+5, -0
 1@@ -7,6 +7,7 @@ DOCKER_TAG?=$(shell git log --format="%H" -n 1)
 2 DOCKER_PLATFORM?=linux/amd64,linux/arm64
 3 DOCKER_CMD?=docker
 4 DOCKER_BUILDX_BUILD?=$(DOCKER_CMD) buildx build --push --platform $(DOCKER_PLATFORM)
 5+WRITE?=0
 6 
 7 css:
 8 	cp ./smol.css lists/public/main.css
 9@@ -95,6 +96,10 @@ pgs-deploy: pgs-static pgs-site
10 	ssh hey@pgs.sh link pgs-prod pgs-local --write
11 .PHONY: pgs-site-deploy
12 
13+store-clean:
14+	WRITE=$(WRITE) go run ./cmd/scripts/clean-object-store/clean.go
15+.PHONY: store-clean
16+
17 fmt:
18 	go fmt ./...
19 .PHONY: format
M cmd/scripts/clean-object-store/clean.go
+6, -2
 1@@ -8,6 +8,7 @@ import (
 2 	"github.com/picosh/pico/db"
 3 	"github.com/picosh/pico/db/postgres"
 4 	"github.com/picosh/pico/pgs"
 5+	"github.com/picosh/pico/shared"
 6 	"github.com/picosh/pico/shared/storage"
 7 	"github.com/picosh/pico/wish/cms/config"
 8 	"go.uber.org/zap"
 9@@ -37,7 +38,11 @@ type RmProject struct {
10 // have a corresponding project inside our database.
11 func main() {
12 	// to actually commit changes, set to true
13+	writeEnv := shared.GetEnv("WRITE", "0")
14 	write := false
15+	if writeEnv == "1" {
16+		write = true
17+	}
18 	logger := createLogger()
19 
20 	picoCfg := config.NewConfigCms()
21@@ -50,7 +55,6 @@ func main() {
22 
23 	var st storage.ObjectStorage
24 	var err error
25-	logger.Info(picoCfg)
26 	st, err = storage.NewStorageMinio(picoCfg.MinioURL, picoCfg.MinioUser, picoCfg.MinioPass)
27 	bail(err)
28 
29@@ -131,6 +135,6 @@ func main() {
30 		logger.Infof("(user: %s) (project: %s)", project.user.Name, project.name)
31 	}
32 	if !write {
33-		logger.Info("WARNING: changes not committed, please go into binary and change `write` var")
34+		logger.Info("WARNING: changes not committed, need env var WRITE=1")
35 	}
36 }