public function getProfile($name) {
    $dirs = $this->config['profile.dirs'];
    foreach ($dirs as $dir) {
      if (!is_dir($dir) || !is_readable($dir)) {
        continue;
      }
      $filename = $dir . DIRECTORY_SEPARATOR . $name . '.profile';
      if (is_readable($filename)) {
        $content = file_get_contents($filename);
        $json = json_decode($content);
        return $json;
      }
    }
    throw new \Exception("Profile $name not found");
  }