Loading CHANGELOG.md +3 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ All notable changes to this project are documented below. The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org). ## [Unreleased] ### Added - Ensure runtime environment values are exposed through the Go runtime InitModule context. ### Changed - Log more error information when InitModule hooks from Go runtime plugins return errors. Loading server/runtime_go.go +4 −1 Original line number Diff line number Diff line Loading @@ -1790,6 +1790,9 @@ func NewRuntimeProviderGo(logger, startupLogger *zap.Logger, db *sql.DB, config matchLock: matchLock, } // The baseline context that will be passed to all InitModule calls. ctx := NewRuntimeGoContext(context.Background(), env, RuntimeExecutionModeRunOnce, nil, 0, "", "", "", "", "") modulePaths := make([]string, 0) for _, path := range paths { if strings.ToLower(filepath.Ext(path)) != ".so" { Loading Loading @@ -1821,7 +1824,7 @@ func NewRuntimeProviderGo(logger, startupLogger *zap.Logger, db *sql.DB, config } // Run the initialisation. if err = fn(context.Background(), stdLogger, db, nk, initializer); err != nil { if err = fn(ctx, stdLogger, db, nk, initializer); err != nil { startupLogger.Fatal("Error returned by InitModule function in Go module", zap.String("name", name), zap.Error(err)) return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, errors.New("error returned by InitModule function in Go module") } Loading server/runtime_go_context.go +4 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,10 @@ import ( func NewRuntimeGoContext(ctx context.Context, env map[string]string, mode RuntimeExecutionMode, queryParams map[string][]string, sessionExpiry int64, userID, username, sessionID, clientIP, clientPort string) context.Context { ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_ENV, env) ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_MODE, mode.String()) if queryParams != nil { ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_QUERY_PARAMS, queryParams) } if userID != "" { ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_USER_ID, userID) Loading Loading
CHANGELOG.md +3 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,9 @@ All notable changes to this project are documented below. The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org). ## [Unreleased] ### Added - Ensure runtime environment values are exposed through the Go runtime InitModule context. ### Changed - Log more error information when InitModule hooks from Go runtime plugins return errors. Loading
server/runtime_go.go +4 −1 Original line number Diff line number Diff line Loading @@ -1790,6 +1790,9 @@ func NewRuntimeProviderGo(logger, startupLogger *zap.Logger, db *sql.DB, config matchLock: matchLock, } // The baseline context that will be passed to all InitModule calls. ctx := NewRuntimeGoContext(context.Background(), env, RuntimeExecutionModeRunOnce, nil, 0, "", "", "", "", "") modulePaths := make([]string, 0) for _, path := range paths { if strings.ToLower(filepath.Ext(path)) != ".so" { Loading Loading @@ -1821,7 +1824,7 @@ func NewRuntimeProviderGo(logger, startupLogger *zap.Logger, db *sql.DB, config } // Run the initialisation. if err = fn(context.Background(), stdLogger, db, nk, initializer); err != nil { if err = fn(ctx, stdLogger, db, nk, initializer); err != nil { startupLogger.Fatal("Error returned by InitModule function in Go module", zap.String("name", name), zap.Error(err)) return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, errors.New("error returned by InitModule function in Go module") } Loading
server/runtime_go_context.go +4 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,10 @@ import ( func NewRuntimeGoContext(ctx context.Context, env map[string]string, mode RuntimeExecutionMode, queryParams map[string][]string, sessionExpiry int64, userID, username, sessionID, clientIP, clientPort string) context.Context { ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_ENV, env) ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_MODE, mode.String()) if queryParams != nil { ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_QUERY_PARAMS, queryParams) } if userID != "" { ctx = context.WithValue(ctx, runtime.RUNTIME_CTX_USER_ID, userID) Loading