diff --git a/lib/models/config.js b/lib/models/config.js index d1bc757a3..465b93218 100644 --- a/lib/models/config.js +++ b/lib/models/config.js @@ -4,7 +4,16 @@ var mongoose = require('mongoose') var Config = new Schema({ version: Number, - // is there any other configuration we want? + serverName: String, + proxyUrl: String, + + smtp: { + host: String, + port: Number, + user: String, + password: String, + fromAddress: String + } }) module.exports = mongoose.model('Config', Config) diff --git a/lib/routes/api/setup.js b/lib/routes/api/setup.js index 33b6d668e..f3a058cec 100644 --- a/lib/routes/api/setup.js +++ b/lib/routes/api/setup.js @@ -1,4 +1,4 @@ -'use strict'; +'us estrict'; var fs = require('fs'); var path = require('path'); @@ -19,7 +19,7 @@ router.post('/', function (req, res) { } if (needsConfig) { - createConfig(config, function (err) { + createConfig(configData, function (err) { if (err) { return res.status(400).send('Invalid config data'); } @@ -33,6 +33,15 @@ router.post('/', function (req, res) { }); }); } + else { + createUser(userData, function (err) { + if (err) { + return res.status(400).send('Invalid user data'); + } + + res.json('ok'); + }); + } }); }); @@ -42,6 +51,9 @@ function createConfig(config, cb) { // TODO: populate config, modify model first c.version = Config.SCHEMA_VERSION; + c.proxyUrl = config.general.proxyUrl; + c.serverName = config.general.serverName; + c.smtp = config.smtp; c.save(cb); } diff --git a/lib/routes/index.js b/lib/routes/index.js index 414e0b6f0..12074e37a 100644 --- a/lib/routes/index.js +++ b/lib/routes/index.js @@ -49,6 +49,7 @@ exports.index = function(req, res){ Upgrade.isFreshDb(function (err, isFresh) { if (err) { + console.error(err); return res.status(500).send('Database error, make sure you\'ve setup' + 'your mongodb instance correctly.'); } diff --git a/lib/views/setup.html b/lib/views/setup.html index bbb8a4aac..902facb75 100644 --- a/lib/views/setup.html +++ b/lib/views/setup.html @@ -17,7 +17,11 @@

Setup Strider

Basics - + + Publicaly accessible URL for this instance of Strider, e.g. ci.mydomain.com + + + Publicaly accessible URL for this instance of Strider, e.g. ci.mydomain.com @@ -52,23 +56,23 @@

Setup Strider

Email - + Example block-level help text here. - + Example block-level help text here. - + Example block-level help text here. - + Example block-level help text here. - + Example block-level help text here.