Skip to content

Commit

Permalink
have pocketbase store db in user config dir
Browse files Browse the repository at this point in the history
Signed-off-by: Elliot Murphy <[email protected]>
  • Loading branch information
statik committed Sep 24, 2022
1 parent b443dcd commit 7cf00ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
reporter: github-pr-review # Change reporter.
path: "." # Optional.
pattern: "*.sh" # Optional.
Expand All @@ -33,7 +33,7 @@ jobs:
uses: reviewdog/action-golangci-lint@v2
with:
reporter: github-pr-review
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
golangci_lint_flags: "--config=.golangci.yml"
verify-labels:
name: verify labels
Expand Down
17 changes: 16 additions & 1 deletion cmd/fly.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
package cmd

import (
"os"
"path/filepath"

"github.com/muesli/coral"
"github.com/pocketbase/pocketbase"
"github.com/rs/zerolog/log"
Expand All @@ -32,8 +35,20 @@ var flyServerCmd = &coral.Command{
func flyServer(cmd *coral.Command, args []string) {
_ = "127.0.0.1:" + viper.GetString("port")

configDir, err := os.UserConfigDir()
if err != nil {
log.Fatal().Stack().Err(err).Msg("Couldn't locate config dir")
}

configDir = filepath.Join(configDir, "vbs")

os.MkdirAll(configDir, os.ModePerm)

log.Debug().Msgf("running pocketbase\n")
app := pocketbase.New()
app := pocketbase.NewWithConfig(pocketbase.Config{
DefaultDataDir: configDir,
})

if err := app.Start(); err != nil {
log.Fatal().Err(err).Msg("error starting pocketbase")
}
Expand Down

0 comments on commit 7cf00ec

Please sign in to comment.