Skip to content

Commit

Permalink
rename db uri
Browse files Browse the repository at this point in the history
add client api key
  • Loading branch information
Em-Ant committed Aug 25, 2020
1 parent 5f9a104 commit 2f34e33
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 44 deletions.
9 changes: 0 additions & 9 deletions .env.sample

This file was deleted.

68 changes: 37 additions & 31 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html>
<html lang="en-us">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Options, Inc | Transporation App</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Font Awesome -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-aNUYGqSUL9wG/vP7+cWZ5QOM4gsQou3sBfWRr/8S3R1Lv0rysEmnwsRKMbhiQX/O" crossorigin="anonymous"><!-- Ionicons -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet"
integrity="sha384-aNUYGqSUL9wG/vP7+cWZ5QOM4gsQou3sBfWRr/8S3R1Lv0rysEmnwsRKMbhiQX/O" crossorigin="anonymous">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Bootstrap -->
<link rel="stylesheet" href="/static/adminLTE/bootstrap/css/bootstrap.min.css">
Expand All @@ -29,42 +32,45 @@
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>

<body class="hold-transition skin-blue layout-top-nav">
<div id="appView"></div>
<div id="appView"></div>

<!-- /.login-box-body -->

<!-- /.login-box -->

<!-- jQuery 2.1.4 -->
<script src="/static/adminLTE/plugins/jQuery/jQuery-2.1.4.min.js"></script>

<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<!-- /.login-box -->

<!-- Bootstrap 3.3.5 -->
<script src="/static/adminLTE/bootstrap/js/bootstrap.min.js"></script>
<!-- jQuery 2.1.4 -->
<script src="/static/adminLTE/plugins/jQuery/jQuery-2.1.4.min.js"></script>

<script src="/static/adminLTE/plugins/select2/select2.full.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

<!-- iCheck -->
<script src="/static/adminLTE/plugins/iCheck/icheck.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/adminLTE/dist/js/app.min.js"></script>
<!-- Google maps-->
<script src="https://maps.googleapis.com/maps/api/js?libraries=geometry"></script>
<!-- Bootstrap 3.3.5 -->
<script src="/static/adminLTE/bootstrap/js/bootstrap.min.js"></script>

<script src="/static/adminLTE/plugins/select2/select2.full.min.js"></script>


<script type="text/javascript">
var script = '<script type="text/javascript" src="/static/js/markerclusterer';
if (document.location.search.indexOf('compiled') !== -1) {
script += '_packed';
}
script += '.js"><' + '/script>';
document.write(script);
</script>

<script type="text/javascript" src="/static/vendors.js"></script>
<script type="text/javascript" src="/static/bundle.js"></script>
<!-- iCheck -->
<script src="/static/adminLTE/plugins/iCheck/icheck.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/adminLTE/dist/js/app.min.js"></script>
<!-- Google maps-->
<script
src="https://maps.googleapis.com/maps/api/js?libraries=geometry&key=---key---"></script>



<script type="text/javascript">
var script = '<script type="text/javascript" src="/static/js/markerclusterer';
if (document.location.search.indexOf('compiled') !== -1) {
script += '_packed';
}
script += '.js"><' + '/script>';
document.write(script);
</script>

<script type="text/javascript" src="/static/vendors.js"></script>
<script type="text/javascript" src="/static/bundle.js"></script>
</body>
</html>

</html>
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
],
"scripts": {
"start": "node server.js",
"postinstall": "webpack -p --config ./webpack.config.js",
"build": "webpack -p --config ./webpack.config.js",
"postinstall": "node ./replace-key.js",
"test": "make test"
},
"author": "Emanuele Antonelli <[email protected]> (http://emant.altervista.org/)",
Expand Down Expand Up @@ -90,4 +91,4 @@
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.10.0"
}
}
}
8 changes: 8 additions & 0 deletions replace-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var fs = require('fs');
var path = require('path');

var html = fs.readFileSync(path.join(__dirname, 'client', 'public', 'index.html'), 'utf-8')

html.replace('---key---', process.env.GOOGLE_API_CLIENT_KEY);

fs.writeFileSync(path.join(__dirname, 'client', 'public', 'index.html'), html);
10 changes: 10 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DB_URI=mongodb://localhost:27017/options-inc
DB_URI_TEST=mongodb://localhost:27017/options-inc
PORT=8080
APP_URL=http://localhost:8080
SEED_DB=false
NODE_ENV=development
DISABLE_WEBPACK=false
DISABLE_AUTH=false
GOOGLE_API_SERVER_KEY=<google-api-server-key>
GOOGLE_API_CLIENT_KEY=<google-api-client-key>
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== 'production') require('dotenv').load();

require('./app/auth/passport')(passport);

mongoose.connect(process.env.MONGO_URI || process.env.MONGOLAB_URI, function(err){
mongoose.connect(process.env.DB_URI || process.env.MONGOLAB_URI, function(err){
if(err){
console.log('There was an error connecting to the database.');
console.log(err);
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ beforeEach(function (done) {
}

if (mongoose.connection.readyState === 0) {
mongoose.connect(process.env.MONGO_URI_TEST, function (err) {
mongoose.connect(process.env.DB_URI_TEST, function (err) {
if (err) {
throw err;
}
Expand Down

0 comments on commit 2f34e33

Please sign in to comment.