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 ghostAdmin = new GhostAdminAPI({
try {
const ghostAdmin = new GhostAdminAPI({
url: config.ghost.url,
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]
* @returns [string] status