updated server constructor to start properly
This commit is contained in:
parent
74f96dacfb
commit
db306b9901
4 changed files with 12 additions and 15 deletions
2
index.js
2
index.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@ module.exports = (db) => {
|
|||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return new PassportLocalStrategy(
|
||||
{
|
||||
|
|
21
server.js
21
server.js
|
@ -19,9 +19,12 @@ function SpeechServer (config) {
|
|||
this.mysqlConfig = config.mysql;
|
||||
this.siteConfig = config.siteConfig;
|
||||
this.lbrynetConfig = config.lbrynetConfig;
|
||||
this.db = require('./models')(this.mysqlConfig);
|
||||
this.db = require('./models')(config.mysqlConfig);
|
||||
this.PORT = 3000;
|
||||
this.app = (function () {
|
||||
this.speak = (something) => {
|
||||
console.log(something);
|
||||
};
|
||||
this.start = () => {
|
||||
// trust the proxy to get ip address for us
|
||||
app.enable('trust proxy');
|
||||
|
||||
|
@ -69,16 +72,11 @@ function SpeechServer (config) {
|
|||
require('./routes/serve-routes.js')(app);
|
||||
require('./routes/fallback-routes.js')(app);
|
||||
|
||||
return app;
|
||||
}());
|
||||
this.server = (function () {
|
||||
const http = require('http');
|
||||
return http.Server(this.app);
|
||||
})();
|
||||
this.speak = (something) => {
|
||||
console.log(something);
|
||||
const server = http.Server(app);
|
||||
this.startServer(server);
|
||||
};
|
||||
this.start = () => {
|
||||
this.startServer = (server) => {
|
||||
// print config variables
|
||||
require('./helpers/configVarCheck.js')(this.config);
|
||||
this.db.sequelize
|
||||
|
@ -86,8 +84,7 @@ function SpeechServer (config) {
|
|||
.sync()
|
||||
// start the server
|
||||
.then(() => {
|
||||
this.server.listen(this.PORT, () => {
|
||||
logger.info('Trusting proxy?', this.app.get('trust proxy'));
|
||||
server.listen(this.PORT, () => {
|
||||
logger.info(`Server is listening on PORT ${this.PORT}`);
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue