config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvBuildURL            = "BUILD_URL"
	EnvBuildPropertiesFile = "TEAMCITY_BUILD_PROPERTIES_FILE"
)
View Source
const (
	EnvServerURL = "TEAMCITY_URL"
	EnvToken     = "TEAMCITY_TOKEN"
	EnvDSLDir    = "TEAMCITY_DSL_DIR"

	DefaultDSLDirTeamCity = ".teamcity"
	DefaultDSLDirTC       = ".tc"
)

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() string

func DetectServerFromDSL added in v0.4.0

func DetectServerFromDSL() string

func DetectTeamCityDir added in v0.4.0

func DetectTeamCityDir() string

func GetCurrentUser

func GetCurrentUser() string

GetCurrentUser returns the current user from config

func GetServerURL

func GetServerURL() string

func GetToken

func GetToken() string

func Init

func Init() error

func IsBuildEnvironment added in v0.3.0

func IsBuildEnvironment() bool

func IsConfigured

func IsConfigured() bool

IsConfigured returns true if both server URL and token are set

func RemoveServer

func RemoveServer(serverURL string) error

func ResetDSLCache added in v0.4.0

func ResetDSLCache()

ResetDSLCache resets the cached DSL detection results. Used by tests.

func SetServer

func SetServer(serverURL, token, user string) error

func SetUserForServer

func SetUserForServer(serverURL, user string)

SetUserForServer sets the user for a server URL in memory (does not persist to disk). This is useful for tests that need to set the user without modifying the config file.

Types

type BuildAuth added in v0.3.0

type BuildAuth struct {
	ServerURL string
	Username  string
	Password  string
}

func GetBuildAuth added in v0.3.0

func GetBuildAuth() (*BuildAuth, bool)

GetBuildAuth returns build-level credentials if running inside a TeamCity build. Server URL priority: TEAMCITY_URL > BUILD_URL > teamcity.serverUrl property

type Config

type Config struct {
	DefaultServer string                  `mapstructure:"default_server"`
	Servers       map[string]ServerConfig `mapstructure:"servers"`
}

func Get

func Get() *Config

Get returns the current config

type ServerConfig

type ServerConfig struct {
	Token string `mapstructure:"token"`
	User  string `mapstructure:"user"`
}

Jump to

Keyboard shortcuts

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