<commit_before>var express = require('express')
var requireAll = require('./lib/require-all')
var authorization = require('express-authorization')
var passport = require('passport')
var utils = require("./lib/utils")
var BasicStrategy = require("passport-http").BasicStrategy
var User = require("./app/models/user")
var ExternalTransaction = require("./app/models/external_transaction")
var ExternalAccount = require("./app/models/external_account")
var sys = require('sys');
var exec = require('child_process').exec;

passport.use(new BasicStrategy(
  function(username, password, done) {
    User.find({ where: { name: username }}).complete(function (err, user) {
      if (err) { return done(err) }
      if (!user) { return done(null, false) }
      if (!utils.verifyPassword(password, user.salt, user.passwordHash)) { return done(null, false) }
      return done(null, user)
    })
  }
))

ctrls = requireAll({
  dirname: __dirname + '/app/controllers',
  filter: /(.+)\.js(on)?$/
})

var app = express()
app.use(express.static(__dirname + '/public'))
app.use(passport.initialize())

require('./config/initializers/middleware.js').configure(app)

app.get('/api/v1/gateway/settings', function(req, res) {
  User.find({ where: { admin: true }}).complete(function(err, user) {
    if (err) { res.send({ success: false }); return }
    if (!user) { res.send({ success: true, settings: { adminExists: false }}) 
    } else {
      res.send({ success: true, settings: { adminExists: user.admin } })
    }  
  })
})

app.post('/api/v1/gateway/users', ctrls['users'].create)

app.post('/api/v1/gateway/users/login', 
  passport.authenticate('basic', { session: false }),
  ctrls['users'].login);

app.get('/api/v1/gateway/users', function(req, res) {
  User.all().complete(function(err, users){
    if(err){ res.send({ success: false, error: err }); return }
    res.send({ success: true, gatewayUsers: users });
  }); 
});<commit_msg>[FEATURE] Return hot wallet address in settings API call.<commit_after>var express = require('express')
var requireAll = require('./lib/require-all')
var authorization = require('express-authorization')
var passport = require('passport')
var utils = require("./lib/utils")
var BasicStrategy = require("passport-http").BasicStrategy
var User = require("./app/models/user")
var ExternalTransaction = require("./app/models/external_transaction")
var RippleAddress = require('./app/models/ripple_address');
var ExternalAccount = require("./app/models/external_account")
var sys = require('sys');
var exec = require('child_process').exec;

passport.use(new BasicStrategy(
  function(username, password, done) {
    User.find({ where: { name: username }}).complete(function (err, user) {
      if (err) { return done(err) }
      if (!user) { return done(null, false) }
      if (!utils.verifyPassword(password, user.salt, user.passwordHash)) { return done(null, false) }
      return done(null, user)
    })
  }
))

ctrls = requireAll({
  dirname: __dirname + '/app/controllers',
  filter: /(.+)\.js(on)?$/
})

var app = express()
app.use(express.static(__dirname + '/public'))
app.use(passport.initialize())

require('./config/initializers/middleware.js').configure(app)

app.get('/api/v1/users/:id/ripple_addresses', ctrls['ripple_addresses'].userIndex);
app.get('/api/v1/users/:id/ripple_transactions', ctrls['ripple_transactions'].userIndex);

app.get('/api/v1/gateway/settings', function(req, res) {
  User.find({ where: { admin: true }}).complete(function(err, user) {
    if (err) { res.send({ success: false }); return }
    RippleAddress.find({ where: { type: 'hot' }}).complete(function(err, address) {
      if (!user) { 
        res.send({ success: true, settings: { adminExists: false }}) 
      } else {
        res.send({ success: true, settings: { adminExists: user.admin, hotWallet: address.address } })
      }  
    });    
  });
});

app.get('/api/v1/gateway/settings', function(req, res) {
});

app.post('/api/v1/gateway/users', ctrls['users'].create)

app.post('/api/v1/gateway/users/login', 
  passport.authenticate('basic', { session: false }),
  ctrls['users'].login);

app.get('/api/v1/gateway/users', function(req, res) {
  User.all().complete(function(err, users){
    if(err){ res.send({ success: false, error: err }); return }
    res.send({ success: true, gatewayUsers: users });
  }); 
});
{'fraction_non_alphanumeric': 0.18813247470101196, 'fraction_numerical': 0.002529898804047838, 'mean_word_length': 4.362515413070284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4167243', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1388, 'n_words': 290}