mirror of
https://github.com/gravitational/teleport
synced 2024-10-21 17:53:28 +00:00
The following now works: ``` TELEPORT_SITE=two.example.com tsh login ```
This commit is contained in:
parent
269706691c
commit
e832a0aea2
|
@ -173,6 +173,7 @@ const (
|
|||
clusterEnvVar = "TELEPORT_SITE"
|
||||
clusterHelp = "Specify the cluster to connect"
|
||||
bindAddrEnvVar = "TELEPORT_LOGIN_BIND_ADDR"
|
||||
authEnvVar = "TELEPORT_AUTH"
|
||||
)
|
||||
|
||||
// Run executes TSH client. same as main() but easier to test
|
||||
|
@ -197,7 +198,7 @@ func Run(args []string, underTest bool) {
|
|||
app.Flag("compat", "OpenSSH compatibility flag").Hidden().StringVar(&cf.Compatibility)
|
||||
app.Flag("cert-format", "SSH certificate format").StringVar(&cf.CertificateFormat)
|
||||
app.Flag("insecure", "Do not verify server's certificate and host name. Use only in test environments").Default("false").BoolVar(&cf.InsecureSkipVerify)
|
||||
app.Flag("auth", "Specify the type of authentication connector to use.").StringVar(&cf.AuthConnector)
|
||||
app.Flag("auth", "Specify the type of authentication connector to use.").Envar(authEnvVar).StringVar(&cf.AuthConnector)
|
||||
app.Flag("namespace", "Namespace of the cluster").Default(defaults.Namespace).Hidden().StringVar(&cf.Namespace)
|
||||
app.Flag("gops", "Start gops endpoint on a given address").Hidden().BoolVar(&cf.Gops)
|
||||
app.Flag("gops-addr", "Specify gops addr to listen on").Hidden().StringVar(&cf.GopsAddr)
|
||||
|
@ -365,6 +366,13 @@ func onLogin(cf *CLIConf) {
|
|||
key *client.Key
|
||||
)
|
||||
|
||||
// populate cluster name from environment variables
|
||||
// only if not set by argument (that does not support env variables)
|
||||
clusterName := os.Getenv(clusterEnvVar)
|
||||
if cf.SiteName == "" {
|
||||
cf.SiteName = clusterName
|
||||
}
|
||||
|
||||
if cf.IdentityFileIn != "" {
|
||||
utils.FatalError(trace.BadParameter("-i flag cannot be used here"))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue