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

Commit

Permalink
fix: Ensures directory path to db file exists
Browse files Browse the repository at this point in the history
fixes #122
  • Loading branch information
hferentschik committed Sep 23, 2022
1 parent f3d6054 commit 945a7ac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ The UI can also be disabled via a runtime flag:
temporalite start --headless
```

## Development

To compile the source run:

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

To run all tests:

```shell
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>
6 changes: 6 additions & 0 deletions cmd/temporalite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
goLog "log"
"net"
"os"
"path/filepath"
"strings"

"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -155,6 +156,11 @@ 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)
}

err := os.MkdirAll(filepath.Dir(c.String(dbPathFlag)), os.ModePerm)
if err != nil {
return cli.Exit(err.Error(), 1)
}

switch c.String(logFormatFlag) {
case "json", "pretty":
default:
Expand Down
2 changes: 1 addition & 1 deletion temporaltest/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestDefaultWorkerOptions(t *testing.T) {
ts.NewWorker("hello_world", func(registry worker.Registry) {
helloworld.RegisterWorkflowsAndActivities(registry)
})

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

Expand Down

0 comments on commit 945a7ac

Please sign in to comment.