Skip to content

Commit 4e4bf4f

Browse files
author
Aaron Schlesinger
committed
fix(boot.go,pkg/sshd/config.go): refactor config
the envconfig time.Duration support doesn’t seem to work properly, so take in an integer seconds and convert it
1 parent dce8ba7 commit 4e4bf4f

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

boot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func main() {
7272
log.Printf("Starting deleted app cleaner")
7373
cleanerErrCh := make(chan error)
7474
go func() {
75-
if err := cleaner.Run(gitHomeDir, kubeClient.Namespaces(), deleteLock, cnf.CleanerPollSleepDuration); err != nil {
75+
if err := cleaner.Run(gitHomeDir, kubeClient.Namespaces(), deleteLock, cnf.CleanerPollSleepDuration()); err != nil {
7676
cleanerErrCh <- err
7777
}
7878
}()

pkg/sshd/config.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import (
66

77
// Config represents the required SSH server configuration
88
type Config struct {
9-
SSHHostIP string `envconfig:"SSH_HOST_IP" default:"0.0.0.0" required:"true"`
10-
SSHHostPort int `envconfig:"SSH_HOST_PORT" default:"2223" required:"true"`
11-
HealthSrvPort int `envconfig:"HEALTH_SERVER_PORT" default:"8092"`
12-
HealthSrvTestStorageRegion string `envconfig:"HEALTH_SERVER_TEST_STORAGE_REGION" default:"us-east-1"`
13-
CleanerPollSleepDuration time.Duration `envconfig:"CLEANER_POLL_SLEEP_DURATION" default:"1s"`
9+
SSHHostIP string `envconfig:"SSH_HOST_IP" default:"0.0.0.0" required:"true"`
10+
SSHHostPort int `envconfig:"SSH_HOST_PORT" default:"2223" required:"true"`
11+
HealthSrvPort int `envconfig:"HEALTH_SERVER_PORT" default:"8092"`
12+
HealthSrvTestStorageRegion string `envconfig:"HEALTH_SERVER_TEST_STORAGE_REGION" default:"us-east-1"`
13+
CleanerPollSleepDurationSec int `envconfig:"CLEANER_POLL_SLEEP_DURATION_SEC" default:"1"`
14+
}
15+
16+
func (c Config) CleanerPollSleepDuration() time.Duration {
17+
return time.Duration(c.CleanerPollSleepDurationSec) * time.Second
1418
}

0 commit comments

Comments
 (0)