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:
parent
a57add4809
commit
751a647a73
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue