mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-06 10:46:38 +00:00
♻️ refactor docker and websocket blueprint to call the new applyBlueprint function
This commit is contained in:
@@ -30,7 +30,12 @@ export async function applyNewtDockerBlueprint(
|
|||||||
logger.debug(`Received Docker blueprint: ${JSON.stringify(blueprint)}`);
|
logger.debug(`Received Docker blueprint: ${JSON.stringify(blueprint)}`);
|
||||||
|
|
||||||
// Update the blueprint in the database
|
// Update the blueprint in the database
|
||||||
await applyBlueprint(site.orgId, blueprint, site.siteId);
|
await applyBlueprint({
|
||||||
|
orgId: site.orgId,
|
||||||
|
configData: blueprint,
|
||||||
|
siteId: site.siteId,
|
||||||
|
source: "NEWT"
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Failed to update database from config: ${error}`);
|
logger.error(`Failed to update database from config: ${error}`);
|
||||||
await sendToClient(newtId, {
|
await sendToClient(newtId, {
|
||||||
|
|||||||
@@ -43,7 +43,12 @@ export const handleApplyBlueprintMessage: MessageHandler = async (context) => {
|
|||||||
try {
|
try {
|
||||||
const blueprintParsed = JSON.parse(blueprint);
|
const blueprintParsed = JSON.parse(blueprint);
|
||||||
// Update the blueprint in the database
|
// Update the blueprint in the database
|
||||||
await applyBlueprint(site.orgId, blueprintParsed, site.siteId);
|
await applyBlueprint({
|
||||||
|
orgId: site.orgId,
|
||||||
|
configData: blueprintParsed,
|
||||||
|
siteId: site.siteId,
|
||||||
|
source: "NEWT"
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Failed to update database from config: ${error}`);
|
logger.error(`Failed to update database from config: ${error}`);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user