Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.
This repository was 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

@hferentschik

Description

@hferentschik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions