Configuration contexts

Not all configuration directives make sense in all contexts. For instance, it doesn't make sense to specify a URL rewrite rule outside of a vhost directive. The DomTool language uses a concept of contexts or predicates to enforce correct usage of directives.

To illustrate, let's try breaking the rule we just gave in our example:

dom "hcoop.net" with
  alias "/doc" "/usr/local/doc"
end;

We ask for the URI prefix doc/ to be mapped to file path /usr/local/doc. The alias directive is only allowed inside vhosts, so we get an error like this:

hcoop.net:0.0-3.4:error: Context incompatibility for nested action.
Have: Domain
Need: Vhost

This one's simple enough. We're in a Domain, but we need to be in a Vhost to use that directive. In full generality, DomTool's context specification language is a small logic that can be used to express much more complicated conditions, while maintaining the ability for the interpreter to check proper usage automatically. See the DomTool/LanguageReference for a full specification.