|
|
@@ -5,6 +5,8 @@ import (
|
|
|
"fmt"
|
|
|
"net"
|
|
|
"net/netip"
|
|
|
+ "runtime/debug"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
@@ -27,6 +29,10 @@ func Main(c *config.C, configTest bool, buildVersion string, logger *logrus.Logg
|
|
|
}
|
|
|
}()
|
|
|
|
|
|
+ if buildVersion == "" {
|
|
|
+ buildVersion = moduleVersion()
|
|
|
+ }
|
|
|
+
|
|
|
l := logger
|
|
|
l.Formatter = &logrus.TextFormatter{
|
|
|
FullTimestamp: true,
|
|
|
@@ -296,3 +302,18 @@ func Main(c *config.C, configTest bool, buildVersion string, logger *logrus.Logg
|
|
|
connManager.Start,
|
|
|
}, nil
|
|
|
}
|
|
|
+
|
|
|
+func moduleVersion() string {
|
|
|
+ info, ok := debug.ReadBuildInfo()
|
|
|
+ if !ok {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, dep := range info.Deps {
|
|
|
+ if dep.Path == "github.com/slackhq/nebula" {
|
|
|
+ return strings.TrimPrefix(dep.Version, "v")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ""
|
|
|
+}
|