What threat are you trying to avoid? It is upon you to tell what is safe. If you know there are three possible values, you can try something like
in reply to Re^2: How to safely define a CGI program's application base directory
in thread How to safely define a CGI program's application base directory
Someone can still tweak the config to point to a wrong path (valid for a different server). You can even include other conditions into the if, not only the single match.