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

Unable to run Temporalite in an environment where $HOME is not defined #213

Open
hferentschik opened this issue May 8, 2023 · 0 comments

Comments

@hferentschik
Copy link
Contributor

Expected Behavior

Trying to start Temporalite in a sandboxed environment (no $HOME or $XDG_CONFIG_HOME environment variable set), specifying an absolute path should work.

Actual Behavior

An error "$HOME is not defined" is returned.

Steps to Reproduce the Problem

  1. unset HOME && temporalite start --namespace default -f $(mktemp -d)/test.db

Specifications

  • Version: trunk
  • Platform: macOS

The problem is that the creation of a new server will fail when the default configuration is created - https://github.com/temporalio/temporalite/blob/f97473349ffc5f52640609c6cddbb61bfa96921f/internal/liteconfig/config.go#L81

func NewDefaultConfig() (*Config, error) {
	userConfigDir, err := os.UserConfigDir()
	if err != nil {
		return nil, fmt.Errorf("cannot determine user config directory: %w", err)
	}
       // ...

In sandboxed environments os.UserConfigDir() can return an error which is not handled here. If the path to the db file is explicitly specified it should still work. Maybe if os.UserConfigDir() returns an error, the db should be created in the current directory as a fallback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant