Documentation
¶
Index ¶
- Constants
- func AddAlias(name, expansion string) error
- func ConfigPath() string
- func DeleteAlias(name string) error
- func DetectServerFromDSL() string
- func DetectTeamCityDir() string
- func GetAlias(name string) (string, bool)
- func GetAllAliases() map[string]string
- func GetCurrentUser() string
- func GetServerURL() string
- func GetToken() string
- func GetTokenWithSource() (token, source string)
- func Init() error
- func IsBuildEnvironment() bool
- func IsConfigured() bool
- func IsShellAlias(name string) bool
- func ParseExpansion(expansion string) (string, bool)
- func RemoveServer(serverURL string) error
- func ResetDSLCache()
- func ResetForTest()
- func SetConfigPathForTest(path string)
- func SetServer(serverURL, token, user string) error
- func SetServerWithKeyring(serverURL, token, user string, insecureStorage bool) (insecureFallback bool, err error)
- func SetUserForServer(serverURL, user string)
- type BuildAuth
- type Config
- type ServerConfig
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 DeleteAlias ¶ added in v0.6.0
func DetectServerFromDSL ¶ added in v0.4.0
func DetectServerFromDSL() string
func DetectTeamCityDir ¶ added in v0.4.0
func DetectTeamCityDir() string
func GetAllAliases ¶ added in v0.6.0
func GetCurrentUser ¶
func GetCurrentUser() string
GetCurrentUser returns the current user from config
func GetServerURL ¶
func GetServerURL() string
func GetTokenWithSource ¶ added in v0.6.0
func GetTokenWithSource() (token, source string)
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 IsShellAlias ¶ added in v0.6.0
func ParseExpansion ¶ added in v0.6.0
ParseExpansion strips the "!" shell prefix from an alias expansion. Returns the clean expansion string and whether it is a shell alias.
func RemoveServer ¶
func ResetDSLCache ¶ added in v0.4.0
func ResetDSLCache()
ResetDSLCache resets the cached DSL detection results. Used by tests.
func ResetForTest ¶ added in v0.6.0
func ResetForTest()
func SetConfigPathForTest ¶ added in v0.6.0
func SetConfigPathForTest(path string)
func SetServerWithKeyring ¶ added in v0.6.0
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
func GetBuildAuth ¶ added in v0.3.0
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"`
Aliases map[string]string `mapstructure:"aliases"`
}
type ServerConfig ¶
Click to show internal directories.
Click to hide internal directories.