isolation

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package isolation resolves worktree-specific local runtime resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled  bool
	Mode     string
	Port     PortConfig
	Database DatabaseConfig
	Services map[string]int
	Env      map[string]string
}

Config describes local resource isolation.

type DatabaseConfig

type DatabaseConfig struct {
	Strategy string
}

DatabaseConfig controls default DSN rewriting.

type PortConfig

type PortConfig struct {
	Strategy string
	Offset   int
	Range    int
	Scan     int
}

PortConfig controls deterministic port remapping.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime is the resolved isolation context for a project.

func Resolve

func Resolve(projectDir string) (*Runtime, error)

Resolve loads isolation config for projectDir and returns its runtime.

func (*Runtime) Active

func (r *Runtime) Active() bool

Active reports whether isolation applies to this runtime.

func (*Runtime) Addr

func (r *Runtime) Addr(addr string) (string, error)

Addr returns addr with its port remapped when isolation is active. It first normalizes a bare numeric port to ":<port>" so a PaaS-injected $PORT (e.g. "8088" from Heroku/Render/Railway/Cloud Run) is a valid http.Server address.

func (*Runtime) Database

func (r *Runtime) Database(driver, dsn string) (string, string, error)

Database returns an isolated database driver and DSN when isolation is active.

func (*Runtime) Env

func (r *Runtime) Env(env []string) []string

Env returns env with configured local resources isolated.

func (*Runtime) ID

func (r *Runtime) ID() string

ID returns the stable isolation identifier.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL