Skip to content

Commit

Permalink
updating websiteUrl automaticall
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiago Passos authored and Thiago Passos committed Oct 5, 2017
1 parent f294ad2 commit 6f5b6a3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/server/config/index.js
Expand Up @@ -4,6 +4,7 @@ var Nconf = require('nconf'),
debug = _debug('ghost:config'),
localUtils = require('./utils'),
env = process.env.NODE_ENV || 'development',
websiteUrl = process.env.websiteUrl,
_private = {};

_private.loadNconf = function loadNconf(options) {
Expand Down Expand Up @@ -35,6 +36,11 @@ _private.loadNconf = function loadNconf(options) {
nconf.file('default-env', path.join(baseConfigPath, 'env', 'config.' + env + '.json'));
nconf.file('defaults', path.join(baseConfigPath, 'defaults.json'));

if (!websiteUrl || websiteUrl === '' || websiteUrl.length === 0) {
websiteUrl = 'http://' + process.env.siteName + '.azurewebsites.net';
console.log(websiteUrl);
}

/**
* transform all relative paths to absolute paths
* transform sqlite filename path for Ghost-CLI
Expand Down Expand Up @@ -63,6 +69,7 @@ _private.loadNconf = function loadNconf(options) {
/**
* values we have to set manual
*/
nconf.set('url',websiteUrl);
nconf.set('env', env);

// Wrap this in a check, because else nconf.get() is executed unnecessarily
Expand Down

0 comments on commit 6f5b6a3

Please sign in to comment.