diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-29 08:22:17 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-29 08:22:17 +0300 |
| commit | 771a1b9712d9906be86578abb6eff8924d490e52 (patch) | |
| tree | 541bd72dd2d59315eabcacf387171122ff700748 | |
| parent | da05e08ad5ef57a29609397d81327c92ce848652 (diff) | |
refactor integration test ssh_host_key configuration
| -rw-r--r-- | internal/config/initializer.go | 1 | ||||
| -rw-r--r-- | internal/ssh/server/hostkey.go | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/internal/config/initializer.go b/internal/config/initializer.go index f1f9b9b..2f4e7cc 100644 --- a/internal/config/initializer.go +++ b/internal/config/initializer.go @@ -83,7 +83,6 @@ func (in *initializer) transformConfig(sourceProcess source.Source, args *Args, func (in *initializer) processEnvVars() { if Env("DTAIL_INTEGRATION_TEST_RUN_MODE") { os.Setenv("DTAIL_HOSTNAME_OVERRIDE", "integrationtest") - in.Server.HostKeyFile = "./ssh_host_key" } } diff --git a/internal/ssh/server/hostkey.go b/internal/ssh/server/hostkey.go index 33bd4e8..4844d36 100644 --- a/internal/ssh/server/hostkey.go +++ b/internal/ssh/server/hostkey.go @@ -12,6 +12,9 @@ import ( // PrivateHostKey retrieves the private server RSA host key. func PrivateHostKey() []byte { hostKeyFile := config.Server.HostKeyFile + if config.Env("DTAIL_INTEGRATION_TEST_RUN_MODE") { + hostKeyFile = "./ssh_host_key" + } _, err := os.Stat(hostKeyFile) if os.IsNotExist(err) { |
