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/'
const ghostAdmin = new GhostAdminAPI({ try {
url: config.ghost.url, const ghostAdmin = new GhostAdminAPI({
version: config.ghost.version, url: config.ghost.url,
key: config.ghost.admin_key, version: config.ghost.version,
}) 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