Gracefully fail if Ghost admin not set

This is still ungraceful, in the sense it'll fail spectacularly
later, but at least it gives us the opportunity to run the new
`setup` command first.

Where's that command, you say? Just wait for the next commit! ;-)
This commit is contained in:
Hippo 2020-04-26 21:11:15 +05:30
parent a57add4809
commit 751a647a73

View file

@ -13,12 +13,15 @@ const config = require('./config')
const MEDIUM_IMG_CDN = 'https://miro.medium.com/fit/c/' const MEDIUM_IMG_CDN = 'https://miro.medium.com/fit/c/'
try {
const ghostAdmin = new GhostAdminAPI({ const ghostAdmin = new GhostAdminAPI({
url: config.ghost.url, url: config.ghost.url,
version: config.ghost.version, version: config.ghost.version,
key: config.ghost.admin_key, key: config.ghost.admin_key,
}) })
} catch(err) {
console.error('Your Ghost isn\'t configured. Please run `seance setup` to fix this!')
}
/** /**
* function [fetchFromMedium] * function [fetchFromMedium]
* @returns [string] status * @returns [string] status