Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide flow- and global context to mustache #29

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lebalz
Copy link

@lebalz lebalz commented Dec 13, 2022

atm it is not possible to access data other than msg within mustache. With this change, the flow and global context is accessible aswell inside mustache templates.

atm it is not possible to access data other than `msg` within mustache. With this change, the `flow` and `global` context is accessible aswell inside mustache templates.
@lebalz
Copy link
Author

lebalz commented Dec 13, 2022

@Alkarex Thanks for the awesome pg-node!

I had no time to set it up local and to test it. Even i think it shall work, a carefull review seems to be needed. Thanks :)

@Alkarex
Copy link
Member

Alkarex commented Dec 13, 2022

Thanks for the PR. I am a bit hesitating. I am afraid of a number of possible regressions due to that, in particular on performance (in case of many and/or large values), or unwanted side effects (I have not checked in details whether we risk calling some functions as properties or sub-properties of some context values).
To access those context values, I would rather expose them in the msg object upstream.
It is not possible to call functions from Mustache, is it?

@lebalz
Copy link
Author

lebalz commented Dec 14, 2022

I see your concerns. I think mustache can somehow call function with a special annotation and setup of the function, but their examples are not working at all in the context of NR.

Probably another approach would be to add the possibility to add custom fields/expressions within the pg node? Those are then evaluated and passed to mustache?

This feature would be nice for portability. In my case, i have the exact same flow except the db-table name. It would be nice, if i only need to set a flow variable once and then use it in the queries...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants