Help us shape the future of Go! Take the 2026 Go Developer Survey

envref

package
v0.4.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package envref resolves references between deployments' environment variables. A value written as ${{ api.DATABASE_URL }} takes the value of DATABASE_URL in the api deployment, and ${{ api.FLATRUN_HOST }} its address on the shared network. Where variables come from is a Source, so the resolver works the same over files, tests or any other store.

Index

Constants

View Source
const HostKey = "FLATRUN_HOST"

HostKey is the reserved key that resolves to a deployment's address.

Variables

View Source
var ErrUnknownDeployment = fmt.Errorf("deployment not found")

Functions

func HasReference

func HasReference(value string) bool

HasReference reports whether a value contains at least one reference.

Types

type Error

type Error struct {
	Key    string
	Reason string
}

Error reports the variable that could not be resolved and why.

func (*Error) Error

func (e *Error) Error() string

type Resolver

type Resolver struct {
	Source Source
}

func (Resolver) Resolve

func (r Resolver) Resolve(self string, vars map[string]string) (map[string]string, error)

Resolve returns vars with every reference replaced. self names the deployment vars belong to, so its own variables can reference each other.

type Source

type Source interface {
	Raw(deployment string) (map[string]string, error)
	Host(deployment string) (string, error)
}

Source supplies the raw (unresolved) variables of a deployment and its address. Raw returns ErrUnknownDeployment for a deployment that does not exist.

Jump to

Keyboard shortcuts

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