env

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package env reads the METAXISDATA_* environment, which is where a project's analysis scopes come from.

Scopes are deliberately never persisted. Several agents can share a machine while serving different projects, and anything remembered between runs would be silently overwritten by whichever agent ran last. Keeping the scopes in the process environment makes the isolation the caller's, which is where the decision belongs.

Index

Constants

View Source
const (
	// ServerEnv is the server address. It is saved on the first `auth login
	// --server`, so later commands do not need it.
	ServerEnv = "METAXISDATA_SERVER"
	// TokenEnv injects a bearer token directly, for CI.
	TokenEnv = "METAXISDATA_TOKEN"
	// ScopesEnv lists the analysis scopes: comma separated entries, each either
	// a GUID or "name=guid".
	ScopesEnv = "METAXISDATA_SCOPES"
	// ConfigEnv points at the credentials file to use, skipping the default
	// location. This is how one machine holds several identities.
	ConfigEnv = "METAXISDATA_CONFIG"
	// ServiceKeyEnv carries a service account's key for the service-account
	// login path.
	ServiceKeyEnv = "METAXISDATA_SERVICE_KEY"
)

The environment variables the CLI reads.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scope

type Scope struct {
	Name string
	GUID string
}

Scope is one named analysis scope. The name is an opaque label used to attribute results; the GUID is what the server resolves the statement against.

func Lookup

func Lookup(scopes []Scope, name string) (Scope, bool)

Lookup returns the scope with the given name, and whether it exists. A bare GUID is not a name, so a typo cannot silently resolve to something else.

func ParseScopes

func ParseScopes(raw string) ([]Scope, error)

ParseScopes reads the METAXISDATA_SCOPES format: comma separated entries, each a bare GUID or "name=guid". GUIDs use ";" as their own separator, so the two never collide.

func Select

func Select(configured []Scope, values []string) ([]Scope, error)

Select resolves the values of --scope against the configured scopes. A value that is a GUID is taken as-is, since a caller who pastes one knows what it is; anything else has to name a configured scope. "all" selects every configured scope.

Jump to

Keyboard shortcuts

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