mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
consistent script processor environments
This commit is contained in:
@@ -101,6 +101,11 @@ type TemplateData struct {
|
||||
Sender any
|
||||
}
|
||||
|
||||
type EnvData struct {
|
||||
Payload any
|
||||
Sender any
|
||||
}
|
||||
|
||||
func GetTemplateData(ctx context.Context, payload any) TemplateData {
|
||||
templateData := TemplateData{Payload: payload}
|
||||
modules := ctx.Value(common.ModulesContextKey)
|
||||
@@ -114,3 +119,13 @@ func GetTemplateData(ctx context.Context, payload any) TemplateData {
|
||||
}
|
||||
return templateData
|
||||
}
|
||||
|
||||
func GetEnvData(ctx context.Context, payload any) EnvData {
|
||||
envData := EnvData{Payload: payload}
|
||||
|
||||
sender := ctx.Value(common.SenderContextKey)
|
||||
if sender != nil {
|
||||
envData.Sender = sender
|
||||
}
|
||||
return envData
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user