updates
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* Imports
|
||||
*/
|
||||
const https = require("https");
|
||||
const http = require("http");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
@@ -38,6 +39,10 @@ async function updateApiSchemaFromLocalDb() {
|
||||
|
||||
const dbSchema = JSON.parse(fs.readFileSync(dbSchemaPath, "utf8"));
|
||||
|
||||
const scheme = process.env.DSQL_HTTP_SCHEME;
|
||||
const localHost = process.env.DSQL_LOCAL_HOST;
|
||||
const localHostPort = process.env.DSQL_LOCAL_HOST_PORT;
|
||||
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@@ -63,7 +68,9 @@ async function updateApiSchemaFromLocalDb() {
|
||||
|
||||
const reqPayload = reqPayloadString;
|
||||
|
||||
const httpsRequest = https.request(
|
||||
const httpsRequest = (
|
||||
scheme?.match(/^http$/i) ? http : https
|
||||
).request(
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -71,8 +78,8 @@ async function updateApiSchemaFromLocalDb() {
|
||||
"Content-Length": Buffer.from(reqPayload).length,
|
||||
Authorization: key,
|
||||
},
|
||||
port: 443,
|
||||
hostname: "datasquirel.com",
|
||||
port: localHostPort || 443,
|
||||
hostname: localHost || "datasquirel.com",
|
||||
path: `/api/query/update-schema-from-single-database`,
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user