Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
feat: fix url import
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
  • Loading branch information
mikemurray committed Mar 30, 2020
1 parent af75059 commit 9e650f1
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions package/bin/create-hydra-client.js
@@ -1,29 +1,29 @@
#!/usr/bin/env node

/* eslint-disable node/shebang */
/* eslint-disable no-console */

const http = require("http");
// const URL = require("url");
const { URL } = require("url");

// const missing = [
// "OAUTH2_ADMIN_URL",
// "OAUTH2_CLIENT_ID",
// "ROOT_URL"
// ].filter((key) => !process.env[key]);

const OAUTH2_ADMIN_HOST = "localhost"
const OAUTH2_ADMIN_HOST = "localhost";
const OAUTH2_ADMIN_PORT = 4445;
const OAUTH2_CLIENT_ID = "reaction-admin-core"
const ROOT_URL = "http://localhost:8081"
const OAUTH2_CLIENT_ID = "reaction-admin-core";
const ROOT_URL = "http://localhost:8081";

// if (missing.length) {
// console.error(`ERROR: Missing required environment variables ${missing.join(" ")}`);
// process.exit(12);
// }

const makeAbsolute = (relativeUrl, baseUrl = ROOT_URL) => {
// const url = new URL(relativeUrl, baseUrl);
// return url.href;
return `${ROOT_URL}${relativeUrl}`;
const url = new URL(relativeUrl, baseUrl);
return url.href;
};

/* eslint-disable camelcase */
Expand Down Expand Up @@ -71,6 +71,7 @@ const req = http.request(options, (res) => {
default:
console.error("ERROR: Could not create hydra client");
console.error(body);
// eslint-disable-next-line no-process-exit
process.exit(10);
}
});
Expand All @@ -79,6 +80,7 @@ const req = http.request(options, (res) => {
req.on("error", (error) => {
console.error("ERROR: Could not create hydra client");
console.error(error.message);
// eslint-disable-next-line no-process-exit
process.exit(11);
});

Expand Down

0 comments on commit 9e650f1

Please sign in to comment.