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

environment

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// HistoryDir history save path
	HistoryDir = "history"
)

Variables

View Source
var (
	DebugMode = false
)

Global flags

EnvList is the canonical allowlist of environment variables TiUP will print or expose. Keep this list as the single source of truth for env visibility.

View Source
var (
	// ErrInstallFirst indicates that a component/version is not installed
	ErrInstallFirst = errors.New("component not installed")
)

Functions

func HideSensitiveInfo added in v1.16.5

func HideSensitiveInfo(args []string) []string

HideSensitiveInfo replaces password and other sensitive info with ******

func HistoryRecord added in v1.10.0

func HistoryRecord(env *Environment, command []string, date time.Time, code int) error

HistoryRecord record tiup exec cmd

func Mirror

func Mirror() string

Mirror return mirror of tiup. If it's not defined, it will use "https://tiup-mirrors.pingcap.com/".

func ParseCompVersion

func ParseCompVersion(spec string) (string, utils.Version)

ParseCompVersion parses component part from <component>[:version] specification

func SetGlobalEnv added in v1.0.2

func SetGlobalEnv(env *Environment)

SetGlobalEnv the global env used.

func WhitelistedEnvs added in v1.16.5

func WhitelistedEnvs() []string

WhitelistedEnvs returns only the environment variables defined in EnvList, formatted as KEY=VALUE strings. Empty values are omitted.

Types

type Environment

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

Environment is the user's fundamental configuration including local and remote parts.

func GlobalEnv added in v1.0.2

func GlobalEnv() *Environment

GlobalEnv Get the global env used.

func InitEnv

func InitEnv(options repository.Options, mOpt repository.MirrorOptions) (*Environment, error)

InitEnv creates a new Environment object configured using env vars and defaults.

func (*Environment) BinaryPath

func (env *Environment) BinaryPath(component string, ver utils.Version) (string, error)

BinaryPath return the installed binary path.

func (*Environment) Close

func (env *Environment) Close() error

Close release resource of env.

func (*Environment) DeleteHistory added in v1.10.0

func (env *Environment) DeleteHistory(retainDays int, skipConfirm bool) error

DeleteHistory delete history file

func (*Environment) GetHistory added in v1.10.0

func (env *Environment) GetHistory(count int, all bool) ([]*historyRow, error)

GetHistory get tiup history

func (env *Environment) Link(component string, version utils.Version) error

Link add soft link to $TIUP_HOME/bin/

func (*Environment) LocalPath

func (env *Environment) LocalPath(path ...string) string

LocalPath returns the local path absolute path

func (*Environment) Profile

func (env *Environment) Profile() *localdata.Profile

Profile returns the profile of local data

func (*Environment) SelectInstalledVersion

func (env *Environment) SelectInstalledVersion(component string, ver utils.Version) (utils.Version, error)

SelectInstalledVersion selects the installed versions and the latest release version will be chosen if there is an empty version

func (*Environment) SelfUpdate

func (env *Environment) SelfUpdate() error

SelfUpdate updates TiUP.

func (*Environment) SetProfile

func (env *Environment) SetProfile(p *localdata.Profile)

SetProfile exports for test

func (*Environment) UpdateComponents

func (env *Environment) UpdateComponents(specs []string, nightly, force bool) error

UpdateComponents updates or installs all components described by specs.

func (*Environment) V1Repository

func (env *Environment) V1Repository() repository.Repository

V1Repository returns the initialized v1 repository

Jump to

Keyboard shortcuts

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