We were able to set these context options using this method suggested in another thread by Bob Ray:
$modx->setOption('site_url', 'http://www.mySite.com/');$modx->setPlaceholder('+site_url', 'http://www.mySite.com/');
That seems to work though I'd still like to try your method as well. Once the site_url is set on the context, I am referencing it to set the base url:
What I found is that this is not reliable when page caching is turned on for the context resource. With caching on the values will reflect those that were obviously set in the context of a different domain (not the current session).
So it seems that the problem I have now is not so much how to set the option on the context but how to reference the option with page caching on and still get the correct option value I set in the gateway.
I've found that I have this problem when referencing both site_settings I defined using the above method, standard resource settings like title, and tvs that are set on the resource. In all cases I am using the ! no cache option:
<meta name="description" content="[[!*description]]" />
Any suggestions? I've turned off page caching on all resources that need to reference settings and it works, but that is almost all the site resources and I'm worried that performance will suffer.