diff options
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/env.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/config/env.go b/internal/config/env.go index 1ccac9c..2eff7b0 100644 --- a/internal/config/env.go +++ b/internal/config/env.go @@ -9,10 +9,20 @@ func Env(env string) bool { // Hostname returns the current hostname. It can be overriden with // DTAIL_HOSTNAME_OVERRIDE environment variable (useful for integration tests). +// When DTAIL_INTEGRATION_TEST_RUN_MODE is set to "yes", it automatically +// returns "integrationtest" as the hostname. func Hostname() (string, error) { + // Check if we're in integration test mode + if Env("DTAIL_INTEGRATION_TEST_RUN_MODE") { + return "integrationtest", nil + } + + // Check for manual hostname override hostname := os.Getenv("DTAIL_HOSTNAME_OVERRIDE") if len(hostname) > 0 { return hostname, nil } + + // Return actual hostname return os.Hostname() } |
