Documentation
¶
Overview ¶
Package isolation resolves worktree-specific local runtime resources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAddr ¶ added in v0.82.0
ListenAddr is the one call a hand-written main needs to bind where `gofastr dev`, a PaaS, or worktree isolation says: it resolves isolation for projectDir, reads $PORT (a bare port "8088" or a host:port "localhost:8088", both of which `gofastr dev` and PaaS runtimes inject), falls back to fallback when $PORT is empty, and returns the address with isolation's port remap applied. Pass the result to App.Start or http.ListenAndServe.
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 ¶
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 (*Runtime) Addr ¶
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 ¶
Database returns an isolated database driver and DSN when isolation is active.
func (*Runtime) Env ¶
Env returns env with configured local resources isolated. Entries from the project's isolation.env are limited to template values (ports, id, project dir) for variables the operator has NOT set: an operator export always wins, and process-shaping names never come from the file (loadConfig already dropped both, this is the second half of the same rule). GOFASTR_ISOLATION_REWRITE governs only the PORT and DATABASE_URL remaps.