Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Ensure default directory path to db file exists (#140)
Browse files Browse the repository at this point in the history
fixes #122
  • Loading branch information
hferentschik committed Sep 24, 2022
1 parent 06b1f4a commit 8833863
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ For example, to disable search attribute cache to make created search attributes
temporalite start --dynamic-config-value system.forceSearchAttributesCacheRefreshOnRead=true
```

## Development

To compile the source run:

```bash
go build -o dist/temporalite ./cmd/temporalite
```

To run all tests:

```bash
go test ./...
```

## Known Issues

- When consuming Temporalite as a library in go mod, you may want to replace grpc-gateway with a fork to address URL escaping issue in UI. See <https://github.com/temporalio/temporalite/pull/118>
8 changes: 8 additions & 0 deletions cmd/temporalite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
goLog "log"
"net"
"os"
"path/filepath"
"strings"

"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -168,6 +169,13 @@ func buildCLI() *cli.App {
return cli.Exit(fmt.Sprintf("ERROR: only one of %q or %q flags may be passed at a time", ephemeralFlag, dbPathFlag), 1)
}

// Make sure the default db path exists (user does not specify path explicitly)
if !c.IsSet(dbPathFlag) {
if err := os.MkdirAll(filepath.Dir(c.String(dbPathFlag)), os.ModePerm); err != nil {
return cli.Exit(err.Error(), 1)
}
}

switch c.String(logFormatFlag) {
case "json", "pretty":
default:
Expand Down

0 comments on commit 8833863

Please sign in to comment.