build: Append commit hash to the main LND context

It can be disabled via the new `logging.no-commit-hash` config option.
This commit is contained in:
Elle Mouton committed 2024-12-02 09:23:06 +02:00
1 parent efe08b836e
commit 755ad49440
5 files changed
+47 -6

No files matched your search

+9 -4
View File
@@ -155,6 +155,15 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
}
}()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx, err := build.WithBuildInfo(ctx, cfg.LogConfig)
if err != nil {
return fmt.Errorf("unable to add build info to context: %w",
err)
}
mkErr := func(format string, args ...interface{}) error {
ltndLog.Errorf("Shutting down because error in main "+
"method: "+format, args...)
@@ -188,10 +197,6 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
strings.Title(BitcoinChainName), network,
)
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
// Enable http profiling server if requested.
if cfg.Pprof.Profile != "" {
// Create the http handler.