Browse Source

New config

stuff
xcps 7 years ago
parent
commit
f45c70df51
  1. 3
      app.js
  2. 6
      bin/syncBlockchain.babel.js
  3. 51
      config/config.json.example
  4. 4
      models/index.js

3
app.js

@ -4,6 +4,7 @@ var favicon = require('serve-favicon'); @@ -4,6 +4,7 @@ var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var env = require('./config/config.json')['env'];
var index = require('./routes/index');
var address = require('./routes/address');
@ -42,7 +43,7 @@ app.use(function(req, res, next) { @@ -42,7 +43,7 @@ app.use(function(req, res, next) {
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
res.locals.error = env === 'development' ? err : {};
// render the error page
res.status(err.status || 500);

6
bin/syncBlockchain.babel.js

@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@
var http = require('http');
var models = require('../models');
var rpcConfig = require('../config/config')['rpc'];
const username = 'gostcoinrpc';
const password = 'CEQLt9zrNnmyzosSV7pjb3EksAkuY9qeqoUCwDQc2wPc';
const hostname = '127.0.0.1';
const port = 9376;
const {username, password, hostname, port} = rpcConfig;
function MakeRPCRequest(postData) {
return new Promise(function(resolve, reject) {

51
config/config.json.example

@ -1,25 +1,34 @@ @@ -1,25 +1,34 @@
{
"development": {
"username": "geuser",
"password": "geuser",
"database": "gedb",
"host": "127.0.0.1",
"dialect": "mysql",
"logging": false
"database": {
"development": {
"username": "geuser",
"password": "geuser",
"database": "gedb",
"host": "127.0.0.1",
"dialect": "mysql",
"logging": false
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "geuser",
"password": "geuser",
"database": "gedb",
"host": "127.0.0.1",
"dialect": "mysql",
"logging": false
}
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
"rpc": {
"username": "gostcoinrpc",
"password": "CEQLt9zrNnmyzosSV7pjb3EksAkuY9qeqoUCwDQc2wPc",
"hostname": "127.0.0.1",
"port": 9376
},
"production": {
"username": "geuser",
"password": "geuser",
"database": "gedb",
"host": "127.0.0.1",
"dialect": "mysql",
"logging": false
}
"env": "production"
}

4
models/index.js

@ -4,8 +4,8 @@ var fs = require('fs'); @@ -4,8 +4,8 @@ var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var basename = path.basename(__filename);
var env = process.env.NODE_ENV || 'development';
var config = require(__dirname + '/../config/config.json')[env];
var env = require(__dirname + '/../config/config.json')['env'] || 'development';
var config = require(__dirname + '/../config/config.json')['database'][env];
var db = {};
if (config.use_env_variable) {

Loading…
Cancel
Save