Load metadata in beginning of pushToGhost rather than end

So that we can refer to it in the meantime
This commit is contained in:
Hippo 2020-01-01 21:35:23 +05:30
parent 821111df5e
commit 2131d76fd5

View file

@ -111,11 +111,17 @@ const pushToGhost = async (postSlug) => {
)
// Path where WebDAV files will be placed (eg. https://example.com:2078)
var davPath = path.join(process.env.WEBDAV_PATH_PREFIX, uploadPath)
const davPath = path.join(process.env.WEBDAV_PATH_PREFIX, uploadPath)
// Public path to upload those files (eg. https://media.example.com/uploads)
// We'll do it directly since path.join mangles the protocol
var uploadedPath = process.env.WEBDAV_UPLOADED_PATH_PREFIX + '/' + uploadPath
const uploadedPath = process.env.WEBDAV_UPLOADED_PATH_PREFIX + '/' + uploadPath
// load metadata file
console.debug('Loading metadata')
postMetaFile = path.join(postFolder, 'metadata.json')
let postMeta = await JSON.parse(fs.readFileSync(postMetaFile))
// Process lines
const readInterface = readline.createInterface({