forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs TryGhost#6982 - add defaults.json - add overrides.json - add env specific default values - add nconf wrapper in /config - add config utils in /config/utils.js [ci skip]
- Loading branch information
Showing
9 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"url": "http://localhost:2368", | ||
"urlSSL": false, | ||
"forceAdminSSL": false, | ||
"server": { | ||
"host": "127.0.0.1", | ||
"port": 2368 | ||
}, | ||
"database": { | ||
"client": "sqlite3", | ||
"debug": false, | ||
"connection": { | ||
"filename": "content/data/ghost.db" | ||
} | ||
}, | ||
"privacy": false, | ||
"paths": { | ||
"contentPath": "content/", | ||
"themePath": "content/themes/", | ||
"imagesPath": "content/images/", | ||
"appPath": "content/apps/", | ||
"storagePath": { | ||
"custom": "content/storage/" | ||
}, | ||
"schedulingPath": "core/server/scheduling/" | ||
}, | ||
"storage": { | ||
"active": { | ||
"images": "local-file-store" | ||
} | ||
}, | ||
"scheduling": { | ||
"active": "SchedulingDefault" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"url": "http://localhost:2368", | ||
"database": { | ||
"connection": { | ||
"filename": "content/data/ghost-dev.db" | ||
}, | ||
"debug": false | ||
}, | ||
"paths": { | ||
"contentPath": "content/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"url": "http://my-ghost-blog.com", | ||
"database": { | ||
"connection": { | ||
"filename": "content/data/ghost.db" | ||
}, | ||
"debug": false | ||
}, | ||
"paths": { | ||
"contentPath": "content/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"url": "http://127.0.0.1:2369", | ||
"server": { | ||
"port": 2369 | ||
}, | ||
"database": { | ||
"client": "mysql", | ||
"connection": { | ||
"host" : "127.0.0.1", | ||
"user" : "root", | ||
"password" : "", | ||
"database" : "ghost_testing", | ||
"charset" : "utf8" | ||
} | ||
}, | ||
"logging": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"url": "http://127.0.0.1:2369", | ||
"server": { | ||
"port": 2369 | ||
}, | ||
"database": { | ||
"client": "pg", | ||
"connection": { | ||
"host" : "127.0.0.1", | ||
"user" : "postgres", | ||
"password" : "", | ||
"database" : "ghost_testing", | ||
"charset" : "utf8" | ||
} | ||
}, | ||
"logging": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"url": "http://127.0.0.1:2369", | ||
"database": { | ||
"connection": { | ||
"filename": "content/data/ghost-test.db" | ||
}, | ||
"useNullAsDefault": true | ||
}, | ||
"server": { | ||
"port": 2369 | ||
}, | ||
"logging": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var nconf = require('nconf'), | ||
path = require('path'), | ||
localUtils = require('./utils'), | ||
env = process.env.NODE_ENV || 'development'; | ||
|
||
nconf.set('NODE_ENV', env); | ||
|
||
/** | ||
* command line arguments | ||
*/ | ||
nconf.argv(); | ||
|
||
/** | ||
* env arguments | ||
*/ | ||
nconf.env(); | ||
|
||
/** | ||
* load config files | ||
*/ | ||
nconf.file('1', __dirname + '/overrides.json'); | ||
nconf.file('2', path.join(process.cwd(), 'config.' + env + '.json')); | ||
nconf.file('3', __dirname + '/env/config.' + env + '.json'); | ||
nconf.file('4', __dirname + '/defaults.json'); | ||
|
||
/** | ||
* transform all relative paths to absolute paths | ||
*/ | ||
localUtils.makePathsAbsolute.bind(nconf)(); | ||
|
||
module.exports = nconf; | ||
module.exports.isPrivacyDisabled = localUtils.isPrivacyDisabled.bind(nconf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"ghostVersion": "0.10.1", | ||
"paths": { | ||
"appRoot": ".", | ||
"corePath": "core/", | ||
"internalAppPath": "core/server/apps/", | ||
"storagePath": { | ||
"default": "core/server/storage/" | ||
}, | ||
"clientAssets": "core/built/assets", | ||
"imagesRelPath": "content/images", | ||
"helperTemplates": "core/server/helpers/tpl/", | ||
"adminViews": "core/server/views/" | ||
}, | ||
"internalApps": [ | ||
"private-blogging", | ||
"subscribers", | ||
"amp" | ||
], | ||
"routeKeywords": { | ||
"tag": "tag", | ||
"author": "author", | ||
"page": "page", | ||
"preview": "p", | ||
"private": "private", | ||
"subscribe": "subscribe", | ||
"amp": "amp" | ||
}, | ||
"slugs": { | ||
"reserved": ["admin", "app", "apps", "archive", "archives", "categories", | ||
"category", "dashboard", "feed", "ghost-admin", "login", "logout", | ||
"page", "pages", "post", "posts", "public", "register", "setup", | ||
"signin", "signout", "signup", "user", "users", "wp-admin", "wp-login"], | ||
"protected": ["ghost", "rss", "amp"] | ||
}, | ||
"uploads": { | ||
"subscribers": { | ||
"extensions": [".csv"], | ||
"contentTypes": ["text/csv", "application/csv", "application/octet-stream"] | ||
}, | ||
"images": { | ||
"extensions": [".jpg", ".jpeg", ".gif", ".png", ".svg", ".svgz"], | ||
"contentTypes": ["image/jpeg", "image/png", "image/gif", "image/svg+xml"] | ||
}, | ||
"db": { | ||
"extensions": [".json", ".zip"], | ||
"contentTypes": ["application/octet-stream", "application/json", "application/zip", "application/x-zip-compressed"] | ||
}, | ||
"themes": { | ||
"extensions": [".zip"], | ||
"contentTypes": ["application/zip", "application/x-zip-compressed"] | ||
} | ||
}, | ||
"storage": { | ||
"active": { | ||
"themes": "local-file-store" | ||
} | ||
}, | ||
"times": { | ||
"cannotScheduleAPostBeforeInMinutes": 2, | ||
"publishAPostBySchedulerToleranceInMinutes": 2 | ||
}, | ||
"theme": { | ||
"timezone": "Etc/UTC" | ||
}, | ||
"maintenance": { | ||
"enabled": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var path = require('path'), | ||
_ = require('lodash'); | ||
|
||
exports.isPrivacyDisabled = function isPrivacyDisabled(privacyFlag) { | ||
if (!this.get('privacy')) { | ||
return false; | ||
} | ||
|
||
if (this.get('privacy').useTinfoil === true) { | ||
return true; | ||
} | ||
|
||
return this.get('privacy')[privacyFlag] === false; | ||
}; | ||
|
||
/** | ||
* transform all relative paths to absolute paths | ||
* @TODO: imagesRelPath is a dirty little attribute (especially when looking at the usages) | ||
*/ | ||
exports.makePathsAbsolute = function makePathsAbsolute(paths, parent) { | ||
var self = this; | ||
|
||
if (!paths && !parent) { | ||
paths = this.get('paths'); | ||
parent = 'paths'; | ||
} | ||
|
||
_.each(paths, function (configValue, pathsKey) { | ||
if (_.isObject(configValue)) { | ||
makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey); | ||
} else { | ||
if (configValue[0] !== '/' && pathsKey !== 'imagesRelPath') { | ||
self.set(parent + ':' + pathsKey, path.join(__dirname + '/../../../', configValue)); | ||
} | ||
} | ||
}); | ||
}; |