protected function processConfigVariables($value, $prefix = null)
    {
        if ($prefix && !preg_match('~^[a-z0-9._-]*$~i', $prefix)) {
            throw new exception\InvalidArgumentException('Invalid config var prefix: ' . $prefix);
        }

        if ($prefix) {
            // dots should be literal in regex
            $prefix = strtr($prefix, '.', '\\.');
        }

        $config = $this;
        $value = preg_replace_callback("~{{({$prefix}[a-z0-9._-]+)}}~i", function($match) use ($config) {
            return (string)$config->getConfigValue($match[1], '');
        }, $value);

        return $value;
    }