From 5120d8481a3b53fd9ac8f5c2e0210101600926ee Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Wed, 12 Jan 2022 12:20:52 -0500 Subject: [PATCH] allow overriding worker hostname with environment variable Signed-off-by: Clint Armstrong --- extern/sector-storage/worker_local.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extern/sector-storage/worker_local.go b/extern/sector-storage/worker_local.go index a5f5a0b9d..213748db7 100644 --- a/extern/sector-storage/worker_local.go +++ b/extern/sector-storage/worker_local.go @@ -582,9 +582,13 @@ func (l *LocalWorker) memInfo() (memPhysical, memUsed, memSwap, memSwapUsed uint } func (l *LocalWorker) Info(context.Context) (storiface.WorkerInfo, error) { - hostname, err := os.Hostname() // TODO: allow overriding from config - if err != nil { - panic(err) + hostname, ok := os.LookupEnv("LOTUS_WORKER_HOSTNAME") + if !ok { + var err error + hostname, err = os.Hostname() + if err != nil { + panic(err) + } } gpus, err := ffi.GetGPUDevices()