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
15
functions.js
15
functions.js
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue