guides icon indicating copy to clipboard operation
guides copied to clipboard

Update text on supplying environment key to accomodate windows users

Open toddjordan opened this issue 8 years ago • 4 comments

In https://guides.emberjs.com/v2.14.0/tutorial/service/#toc_making-google-maps-available

We suggest adding a google maps key to your server runtime by starting the server with GOOGLE_MAPS_API_KEY=<your key here> ember s

This doesn't work on windows, where it needs to be something like

set GOOGLE_MAPS_KEY <your key here>
ember s

We should specify what windows users need to do as well.

toddjordan avatar Jul 21 '17 20:07 toddjordan

cc @danaoira

toddjordan avatar Jul 21 '17 20:07 toddjordan

@toddjordan Thank you for the CC!

danaoira avatar Jul 24 '17 07:07 danaoira

I was following the tutorial and couldnt set google maps api key as stated in the tutorials. While searching for a solution, I came accross this issue. So would like to share my solution here.

On windows I managed to add process variables with ember-cli-dotenv addon.

Install add on by ember install ember-cli-dotenv then create a file named ".env" on your root folder with following content

GOOGLE_MAPS_API_KEY=<your key here>

and create dotenv.js file inside config folder with following content

// config/dotenv.js
module.exports = function(env) {
   return {
     clientAllowedKeys: ['GOOGLE_MAPS_API_KEY']
   };
};

then restart your ember server

Azadrum avatar Nov 24 '17 11:11 Azadrum

I would vote for a crossplatform solution like ember-cli-dotenv.

Also, to avoid getting this error, you need also to find a recent version and do the following:

GOOGLE_MAPS_VERSION='3.31'

c5c86a avatar Nov 28 '17 12:11 c5c86a