mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
closes #6502, also fixed issue with type: 'literal' in config.json
This commit is contained in:
@@ -99,6 +99,8 @@ function welcome(req, res) {
|
|||||||
var defaults = require('./data/defaults');
|
var defaults = require('./data/defaults');
|
||||||
|
|
||||||
res.render('install/index', {
|
res.render('install/index', {
|
||||||
|
url: nconf.get('url') || (req.protocol + '://' + req.get('host')),
|
||||||
|
skipGeneralSetup: !!nconf.get('url'),
|
||||||
databases: databases,
|
databases: databases,
|
||||||
skipDatabaseSetup: !!nconf.get('database'),
|
skipDatabaseSetup: !!nconf.get('database'),
|
||||||
error: !!res.locals.error,
|
error: !!res.locals.error,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var url = require('url');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var prompt = require('prompt');
|
var prompt = require('prompt');
|
||||||
var winston = require('winston');
|
var winston = require('winston');
|
||||||
@@ -16,9 +17,7 @@ questions.main = [
|
|||||||
name: 'url',
|
name: 'url',
|
||||||
description: 'URL used to access this NodeBB',
|
description: 'URL used to access this NodeBB',
|
||||||
default:
|
default:
|
||||||
nconf.get('url') ||
|
nconf.get('url') || 'http://localhost:4567',
|
||||||
(nconf.get('base_url') ? (nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '')) : null) || // backwards compatibility (remove for v0.7.0)
|
|
||||||
'http://localhost:4567',
|
|
||||||
pattern: /^http(?:s)?:\/\//,
|
pattern: /^http(?:s)?:\/\//,
|
||||||
message: 'Base URL must begin with \'http://\' or \'https://\'',
|
message: 'Base URL must begin with \'http://\' or \'https://\'',
|
||||||
},
|
},
|
||||||
@@ -162,7 +161,6 @@ function completeConfigSetup(config, next) {
|
|||||||
config.package_manager = nconf.get('package_manager');
|
config.package_manager = nconf.get('package_manager');
|
||||||
}
|
}
|
||||||
|
|
||||||
nconf.overrides(config);
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
require('./database').init(next);
|
require('./database').init(next);
|
||||||
@@ -171,6 +169,22 @@ function completeConfigSetup(config, next) {
|
|||||||
require('./database').createIndices(next);
|
require('./database').createIndices(next);
|
||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
|
// Sanity-check/fix url/port
|
||||||
|
if (!/^http(?:s)?:\/\//.test(config.url)) {
|
||||||
|
config.url = 'http://' + config.url;
|
||||||
|
}
|
||||||
|
var urlObj = url.parse(config.url);
|
||||||
|
if (urlObj.port) {
|
||||||
|
config.port = urlObj.port;
|
||||||
|
}
|
||||||
|
urlObj.pathname = null;
|
||||||
|
urlObj.path = null;
|
||||||
|
|
||||||
|
config.url = url.format(urlObj);
|
||||||
|
|
||||||
|
// ref: https://github.com/indexzero/nconf/issues/300
|
||||||
|
delete config.type;
|
||||||
|
|
||||||
install.save(config, next);
|
install.save(config, next);
|
||||||
},
|
},
|
||||||
], next);
|
], next);
|
||||||
|
|||||||
@@ -33,6 +33,22 @@
|
|||||||
You are just a few steps away from launching your own NodeBB forum!
|
You are just a few steps away from launching your own NodeBB forum!
|
||||||
</p>
|
</p>
|
||||||
<form id="install" action="/" method="post">
|
<form id="install" action="/" method="post">
|
||||||
|
<!-- IF !skipGeneralSetup -->
|
||||||
|
<div class="general">
|
||||||
|
<p>
|
||||||
|
<h1><small>General Instance Setup</small></h1>
|
||||||
|
<hr />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="row input-row">
|
||||||
|
<div class="col-sm-7 col-xs-12 input-field">
|
||||||
|
<label for="url">Web Address (URL)</label>
|
||||||
|
<input type="text" class="form-control" name="url" value="<!-- IF url -->{url}<!-- ENDIF url -->" placeholder="http://localhost:4567" />
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-5 help-text" data-help="This is the address that resolves to your NodeBB forum. If no port is specified, <code>4567</code> will be used."></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- END -->
|
||||||
<div class="admin">
|
<div class="admin">
|
||||||
<p>
|
<p>
|
||||||
<h1><small>Create an Administrator account</small></h1>
|
<h1><small>Create an Administrator account</small></h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user