mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #6128 from ErisDS/startup-check
Docs link & unique error codes for startup checks
This commit is contained in:
commit
03760c3674
1 changed files with 16 additions and 8 deletions
|
@ -5,7 +5,15 @@ var packages = require('../../../package.json'),
|
||||||
mode = process.env.NODE_ENV === undefined ? 'development' : process.env.NODE_ENV,
|
mode = process.env.NODE_ENV === undefined ? 'development' : process.env.NODE_ENV,
|
||||||
appRoot = path.resolve(__dirname, '../../../'),
|
appRoot = path.resolve(__dirname, '../../../'),
|
||||||
configFilePath = process.env.GHOST_CONFIG || path.join(appRoot, 'config.js'),
|
configFilePath = process.env.GHOST_CONFIG || path.join(appRoot, 'config.js'),
|
||||||
checks;
|
checks,
|
||||||
|
exitCodes = {
|
||||||
|
NODE_VERSION_UNSUPPORTED: 231,
|
||||||
|
NODE_ENV_CONFIG_MISSING: 232,
|
||||||
|
DEPENDENCIES_MISSING: 233,
|
||||||
|
CONTENT_PATH_NOT_ACCESSIBLE: 234,
|
||||||
|
CONTENT_PATH_NOT_WRITABLE: 235,
|
||||||
|
SQLITE_DB_NOT_WRITABLE: 236
|
||||||
|
};
|
||||||
|
|
||||||
checks = {
|
checks = {
|
||||||
check: function check() {
|
check: function check() {
|
||||||
|
@ -27,9 +35,9 @@ checks = {
|
||||||
console.error('\x1B[31mERROR: Unsupported version of Node');
|
console.error('\x1B[31mERROR: Unsupported version of Node');
|
||||||
console.error('\x1B[31mGhost needs Node version ' + packages.engines.node +
|
console.error('\x1B[31mGhost needs Node version ' + packages.engines.node +
|
||||||
' you are using version ' + process.versions.node + '\033[0m\n');
|
' you are using version ' + process.versions.node + '\033[0m\n');
|
||||||
console.error('\x1B[32mPlease go to http://nodejs.org to get a supported version or set GHOST_NODE_VERSION_CHECK=false\033[0m');
|
console.error('\x1B[32mPlease see http://support.ghost.org/supported-node-versions/ for more information\033[0m');
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(exitCodes.NODE_VERSION_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -55,7 +63,7 @@ checks = {
|
||||||
console.error('\x1B[32mEnsure your config.js has a section for the current NODE_ENV value' +
|
console.error('\x1B[32mEnsure your config.js has a section for the current NODE_ENV value' +
|
||||||
' and is formatted properly.\033[0m');
|
' and is formatted properly.\033[0m');
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(exitCodes.NODE_ENV_CONFIG_MISSING);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -85,7 +93,7 @@ checks = {
|
||||||
console.error('\x1B[32m\nPlease run `npm install --production` and try starting Ghost again.');
|
console.error('\x1B[32m\nPlease run `npm install --production` and try starting Ghost again.');
|
||||||
console.error('\x1B[32mHelp and documentation can be found at http://support.ghost.org.\033[0m\n');
|
console.error('\x1B[32mHelp and documentation can be found at http://support.ghost.org.\033[0m\n');
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(exitCodes.DEPENDENCIES_MISSING);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Check content path permissions
|
// Check content path permissions
|
||||||
|
@ -129,7 +137,7 @@ checks = {
|
||||||
console.error(' ' + e.message);
|
console.error(' ' + e.message);
|
||||||
console.error('\n' + errorHelp);
|
console.error('\n' + errorHelp);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(exitCodes.CONTENT_PATH_NOT_ACCESSIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check each of the content path subdirectories
|
// Check each of the content path subdirectories
|
||||||
|
@ -151,7 +159,7 @@ checks = {
|
||||||
console.error(' ' + e.message);
|
console.error(' ' + e.message);
|
||||||
console.error('\n' + errorHelp);
|
console.error('\n' + errorHelp);
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(exitCodes.CONTENT_PATH_NOT_WRITABLE);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -199,7 +207,7 @@ checks = {
|
||||||
console.error('\n\x1B[32mCheck that the sqlite3 database file permissions allow read and write access.');
|
console.error('\n\x1B[32mCheck that the sqlite3 database file permissions allow read and write access.');
|
||||||
console.error('Help and documentation can be found at http://support.ghost.org.\033[0m');
|
console.error('Help and documentation can be found at http://support.ghost.org.\033[0m');
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(exitCodes.SQLITE_DB_NOT_WRITABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue