Skip to content

Commit

Permalink
Merge pull request #34 from UTSA123432/main
Browse files Browse the repository at this point in the history
Techzone logic change
  • Loading branch information
NoeSamaille authored Oct 5, 2022
2 parents e35203c + d55edf6 commit 65006c3
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/controllers/solution.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
import {FILE_UPLOAD_SERVICE} from '../keys';
import {FileUploadHandler, File} from '../types';

import fetch from 'node-fetch';
/* eslint-disable @typescript-eslint/no-explicit-any */

const INSTANCE_ID = process.env.INSTANCE_ID;
Expand Down Expand Up @@ -509,33 +508,17 @@ This solution was built with the [Techzone Accelerator Toolkit](https://builder.
description: 'Download Terraform Package for solution',
})
@oas.response.file()
async downloadAutomationTechzone(
downloadAutomationTechzone(
@param.path.string('id') id: string,
@inject(RestBindings.Http.RESPONSE) res: Response,
) {

try {

// Create zip
const zip = await this.downloadAutomationZip(id, res);

if (!(zip instanceof Buffer)) {
throw Error("Invalid zip file")
}
const bifrostURL = process.env.BIFROST;
if (bifrostURL === undefined) {
throw Error("Bifrost URL is invalid.")
}
const returnValue = await fetch(bifrostURL, {
method: 'POST',
headers: {
'Access-Control-Allow-Origin': "*",
'Content-Type': 'application/zip',
},
body: zip.buffer
})
const techZoneURL = await returnValue.text();
return techZoneURL;
return bifrostURL;
} catch (e:any) {
console.log(e);
return res.status(409).send(e?.message);
Expand Down

0 comments on commit 65006c3

Please sign in to comment.