Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove hardcoded google api key #15478

Merged
merged 2 commits into from Oct 31, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -11,7 +11,6 @@
#include "atom/app/atom_content_client.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/relauncher.h"
#include "atom/common/google_api_key.h"
#include "atom/common/options_switches.h"
#include "atom/renderer/atom_renderer_client.h"
#include "atom/renderer/atom_sandboxed_renderer_client.h"
@@ -31,7 +31,6 @@
#include "atom/browser/web_contents_permission_helper.h"
#include "atom/browser/web_contents_preferences.h"
#include "atom/browser/window_list.h"
#include "atom/common/google_api_key.h"
#include "atom/common/options_switches.h"
#include "atom/common/platform_util.h"
#include "base/command_line.h"
@@ -428,11 +427,11 @@ void AtomBrowserClient::DidCreatePpapiPlugin(content::BrowserPpapiHost* host) {
#endif
}

// attempt to get api key from env
std::string AtomBrowserClient::GetGeolocationApiKey() {
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string api_key;
if (!env->GetVar("GOOGLE_API_KEY", &api_key))
api_key = GOOGLEAPIS_API_KEY;
env->GetVar("GOOGLE_API_KEY", &api_key);
return api_key;
}

This file was deleted.

@@ -48,20 +48,16 @@ Unsupported options are:

### `GOOGLE_API_KEY`

Electron includes a hardcoded API key for making requests to Google's geocoding
webservice. Because this API key is included in every version of Electron, it
often exceeds its usage quota. To work around this, you can supply your own
Google API key in the environment. Place the following code in your main process
You can supply your own Google API key in the environment. Place the following code in your main process

This comment has been minimized.

Copy link
@ckerr

ckerr Oct 30, 2018

Member

This loses the context that the previous revision had of "what is this key for."

Maybe something like

You can provide an API key for making requests to Google's geocoding webservice. To do this, place the following code in your main process

file, before opening any browser windows that will make geocoding requests:

```javascript
process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'
```

For instructions on how to acquire a Google API key, visit [this page](https://www.chromium.org/developers/how-tos/api-keys).

For instructions on how to acquire a Google API key, visit [this page](https://developers.google.com/maps/documentation/javascript/get-api-key).
By default, a newly generated Google API key may not be allowed to make
geocoding requests. To enable geocoding requests, visit [this page](https://console.developers.google.com/apis/api/geolocation/overview).
geocoding requests. To enable geocoding requests, visit [this page](https://developers.google.com/maps/documentation/geocoding/get-api-key).

### `ELECTRON_NO_ASAR`

@@ -576,7 +576,6 @@ filenames = {
"atom/common/crash_reporter/win/crash_service_main.h",
"atom/common/draggable_region.cc",
"atom/common/draggable_region.h",
"atom/common/google_api_key.h",
"atom/common/heap_snapshot.cc",
"atom/common/heap_snapshot.h",
"atom/common/key_weak_map.h",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.