Skip to content

Commit 7cf00ec

Browse files
committed
have pocketbase store db in user config dir
Signed-off-by: Elliot Murphy <statik@users.noreply.github.com>
1 parent b443dcd commit 7cf00ec

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: shellcheck
1717
uses: reviewdog/action-shellcheck@v1
1818
with:
19-
github_token: ${{ secrets.GITHUB_TOKEN }}
19+
github_token: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
2020
reporter: github-pr-review # Change reporter.
2121
path: "." # Optional.
2222
pattern: "*.sh" # Optional.
@@ -33,7 +33,7 @@ jobs:
3333
uses: reviewdog/action-golangci-lint@v2
3434
with:
3535
reporter: github-pr-review
36-
github_token: ${{ secrets.GITHUB_TOKEN }}
36+
github_token: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
3737
golangci_lint_flags: "--config=.golangci.yml"
3838
verify-labels:
3939
name: verify labels

cmd/fly.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
package cmd
1616

1717
import (
18+
"os"
19+
"path/filepath"
20+
1821
"github.com/muesli/coral"
1922
"github.com/pocketbase/pocketbase"
2023
"github.com/rs/zerolog/log"
@@ -32,8 +35,20 @@ var flyServerCmd = &coral.Command{
3235
func flyServer(cmd *coral.Command, args []string) {
3336
_ = "127.0.0.1:" + viper.GetString("port")
3437

38+
configDir, err := os.UserConfigDir()
39+
if err != nil {
40+
log.Fatal().Stack().Err(err).Msg("Couldn't locate config dir")
41+
}
42+
43+
configDir = filepath.Join(configDir, "vbs")
44+
45+
os.MkdirAll(configDir, os.ModePerm)
46+
3547
log.Debug().Msgf("running pocketbase\n")
36-
app := pocketbase.New()
48+
app := pocketbase.NewWithConfig(pocketbase.Config{
49+
DefaultDataDir: configDir,
50+
})
51+
3752
if err := app.Start(); err != nil {
3853
log.Fatal().Err(err).Msg("error starting pocketbase")
3954
}

0 commit comments

Comments
 (0)