Skip to content
Permalink
Browse files

Remove hardcoded google maps API key

  • Loading branch information
L3bowski committed Jun 22, 2019
1 parent e62f6e7 commit fcf068af000ad02b5a38583e44b104edeaeb25cc
Showing with 263 additions and 79 deletions.
  1. +1 −0 .gitignore
  2. +2 −1 config/env/dev.env.js
  3. +2 −1 config/env/prod.env.js
  4. +5 −0 config/webpack.config.common.js
  5. +0 −2 index.html
  6. +11 −0 package-lock.json
  7. +2 −0 package.json
  8. +240 −75 src/components/Trips.vue
@@ -5,6 +5,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
google*.html
.env

# Editor directories and files
.idea
@@ -1,3 +1,4 @@
module.exports = {
NODE_ENV: 'development'
NODE_ENV: 'development',
MAPS_API_KEY: process.env.MAPS_API_KEY
};
@@ -1,3 +1,4 @@
module.exports = {
NODE_ENV: 'production'
NODE_ENV: 'production',
MAPS_API_KEY: process.env.MAPS_API_KEY
};
@@ -7,6 +7,11 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const isDev = process.env.NODE_ENV === 'development';

const envConfig = require('dotenv').config();
if (envConfig.error || !envConfig.parsed.MAPS_API_KEY) {
throw 'The Google Maps API key must be provided through a .env file to build/start the app';
}

const webpackConfig = {
entry: {
index: path.resolve(__dirname, '..', 'src', 'main'),
@@ -42,8 +42,6 @@ <h1>Carles Capellas</h1>
<script src="/plugins/jquery/jquery.min.js?$modena=vue-personal-page"></script>
<script src="/plugins/bootstrap/js/bootstrap.bundle.min.js?$modena=vue-personal-page"></script>

<script src="https://maps.google.com/maps/api/js?key=AIzaSyCOuFGK4DptoUp-h9Eojb3HnVQPWXiv_Eo" type="text/javascript"></script>

<!-- built files will be auto injected -->
</body>
</html>

Some generated files are not rendered by default. Learn more.

@@ -10,6 +10,7 @@
"start": "npm run dev"
},
"dependencies": {
"load-google-maps-api": "^1.3.3",
"vue": "^2.6.10",
"vue-router": "^3.0.1"
},
@@ -26,6 +27,7 @@
"copy-webpack-plugin": "^5.0.3",
"cross-env": "^5.2",
"css-loader": "^2.1",
"dotenv": "^8.0.0",
"express": "^4.17.1",
"friendly-errors-webpack-plugin": "^1.7",
"html-webpack-plugin": "^3.2",

0 comments on commit fcf068a

Please sign in to comment.
You can’t perform that action at this time.