if (keyfile.match(/\.json$/)) {
    const json = JSON.parse(key);
    key = json.private_key;
    email = json.client_email;
  }