IO-2921 Adjustment for SFTP Private Key
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -135,17 +135,17 @@ exports.default = async (req, res) => {
|
|||||||
logger.log("chatter-sftp-error", "ERROR", "api", null, { ...error });
|
logger.log("chatter-sftp-error", "ERROR", "api", null, { ...error });
|
||||||
} finally {
|
} finally {
|
||||||
sftp.end();
|
sftp.end();
|
||||||
|
sendServerEmail({
|
||||||
|
subject: `Chatter Report ${moment().format("MM-DD-YY")}`,
|
||||||
|
text: `Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))}
|
||||||
|
Uploaded: ${JSON.stringify(
|
||||||
|
allcsvsToUpload.map((x) => ({ filename: x.filename, count: x.count })),
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}`
|
||||||
|
});
|
||||||
|
res.sendStatus(200);
|
||||||
}
|
}
|
||||||
sendServerEmail({
|
|
||||||
subject: `Chatter Report ${moment().format("MM-DD-YY")}`,
|
|
||||||
text: `Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))}
|
|
||||||
Uploaded: ${JSON.stringify(
|
|
||||||
allcsvsToUpload.map((x) => ({ filename: x.filename, count: x.count })),
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
)}`
|
|
||||||
});
|
|
||||||
res.sendStatus(200);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(200).json(error);
|
res.status(200).json(error);
|
||||||
}
|
}
|
||||||
@@ -160,8 +160,8 @@ async function getPrivateKey() {
|
|||||||
try {
|
try {
|
||||||
const { SecretString, SecretBinary } = await client.send(command);
|
const { SecretString, SecretBinary } = await client.send(command);
|
||||||
if (SecretString || SecretBinary) logger.log("chatter-retrieved-private-key", "DEBUG", "api", null, null);
|
if (SecretString || SecretBinary) logger.log("chatter-retrieved-private-key", "DEBUG", "api", null, null);
|
||||||
const chatterPrivateKey = SecretString ? JSON.parse(SecretString) : JSON.parse(Buffer.from(SecretBinary, "base64").toString("ascii"));
|
const chatterPrivateKey = SecretString ? SecretString : Buffer.from(SecretBinary, "base64").toString("ascii");
|
||||||
return chatterPrivateKey.private_key;
|
return chatterPrivateKey;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("chatter-get-private-key", "ERROR", "api", null, error);
|
logger.log("chatter-get-private-key", "ERROR", "api", null, error);
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
Reference in New Issue
Block a user