How to set a Configuration node

This is a recurring problem I have. I’m creating a component with config options. one or more of the configurations might have already bean set in the containing workflow and should automatically be reused.

I can’t set the config node to a flow variable because if it doesn’t exist, the component will fail.

java snippet also forces me to check the “replace” option or not so I can’t set a default value that way either? How can one check for existence of a flow variable?

What’s the best way to handle this?