Skip to content

Commit

Permalink
Added debug to config
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyMitch committed Dec 27, 2023
1 parent b5dc2fe commit 317c125
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 12 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import dotenv from "dotenv";
dotenv.config();

const {
SSO_ENVIRONMENT = "dev",
CSS_API_CLIENT_ID = "",
Expand All @@ -7,12 +10,20 @@ const {
CSS_API_URL = "https://api.loginproxy.gov.bc.ca/api/v1",
} = process.env;

if (DEBUG === "true") {
console.log(`DEBUG: 'citz-imb-kc-css-api' environment variables:
SSO_ENVIRONMENT=${SSO_ENVIRONMENT}
CSS_API_CLIENT_ID=${CSS_API_CLIENT_ID}
CSS_API_CLIENT_SECRET=${CSS_API_CLIENT_SECRET}
SSO_INTEGRATION_ID=${SSO_INTEGRATION_ID.replace(/^0+/, "")}`);
}

// Exports.
export default {
DEBUG: DEBUG === "true" ? true : false,
SSO_ENVIRONMENT,
CSS_API_CLIENT_ID,
CSS_API_CLIENT_SECRET,
SSO_INTEGRATION_ID,
SSO_INTEGRATION_ID: SSO_INTEGRATION_ID.replace(/^0+/, ""), // Trim leading zeros.
CSS_API_URL,
};
3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import dotenv from "dotenv";
dotenv.config();

// Roles
export {
getRoles, // Get all roles from integration
Expand Down
3 changes: 1 addition & 2 deletions src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export const request = async (params: RequestParams) => {
};

// Create request url.
const integrationID = SSO_INTEGRATION_ID.replace(/^0+/, ""); // Trim leading zeros.
const integration = `integrations/${integrationID}/`;
const integration = `integrations/${SSO_INTEGRATION_ID}/`;
const url = `${CSS_API_URL}/${
integrationEndpoint && integration
}${SSO_ENVIRONMENT}/${endpoint}`;
Expand Down

0 comments on commit 317c125

Please sign in to comment.