-
Notifications
You must be signed in to change notification settings - Fork 287
/
config.go
38 lines (32 loc) · 978 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package config
import (
"fmt"
"os"
"time"
"github.com/aws/eks-anywhere/pkg/logger"
)
const (
EksaGitPassphraseTokenEnv = "EKSA_GIT_SSH_KEY_PASSPHRASE"
EksaGitPrivateKeyTokenEnv = "EKSA_GIT_PRIVATE_KEY"
EksaGitKnownHostsFileEnv = "EKSA_GIT_KNOWN_HOSTS"
SshKnownHostsEnv = "SSH_KNOWN_HOSTS"
EksaReplicasReadyTimeoutEnv = "EKSA_REPLICAS_READY_TIMEOUT"
)
type CliConfig struct {
GitSshKeyPassphrase string
GitPrivateKeyFile string
GitKnownHostsFile string
MaxWaitPerMachine time.Duration
}
const DefaultMaxWaitPerMachine = 10 * time.Minute
func GetMaxWaitPerMachine() time.Duration {
if env, found := os.LookupEnv(EksaReplicasReadyTimeoutEnv); found {
if duration, err := time.ParseDuration(env); err == nil {
return duration
} else {
logger.V(3).Info(fmt.Sprintf("Invalid EKSA_REPLICAS_READY_TIMEOUT value: %s Use the default timeout: %s",
env, DefaultMaxWaitPerMachine.String()))
}
}
return DefaultMaxWaitPerMachine
}