Commit 0d02a849 authored by Arun Kumar's avatar Arun Kumar
Browse files

added urls from ENV file

parent 1dc5a246
1 merge request!31added urls from ENV file
Showing with 23 additions and 14 deletions
+23 -14
...@@ -7,16 +7,19 @@ const GET_FORM_SUBMISSIONS_BY_STATUS = '/api/rest/getFormSubmissionsByStatus'; ...@@ -7,16 +7,19 @@ const GET_FORM_SUBMISSIONS_BY_STATUS = '/api/rest/getFormSubmissionsByStatus';
const UPDATE_ENDPOINT = "/api/rest/UpdateFormSubmissionStatus"; const UPDATE_ENDPOINT = "/api/rest/UpdateFormSubmissionStatus";
const UPDATE_ASSESSMENT_ENDPOINT = "/rest/assessorUpdateForm" const UPDATE_ASSESSMENT_ENDPOINT = "/rest/assessorUpdateForm"
const SCHEDULES_ENDPOINT = "/rest/getAssessmentSchedule"; const SCHEDULES_ENDPOINT = "/rest/getAssessmentSchedule";
const TARGET_URL = process.env.TARGET_URL || "https://hasura.upsmfac.org"; const TARGET_URL = process.env.TARGET_URL ;
const REACT_APP_NODE_URL = process.env.REACT_APP_API_URL || "https://uphrh.in/api/api"; const REACT_APP_NODE_URL = process.env.REACT_APP_API_URL ;
const AUTH_TOKEN = process.env.REACT_APP_AUTH_TOKEN; const AUTH_TOKEN = process.env.REACT_APP_AUTH_TOKEN;
const hasuraClientName = process.env.HASURA_CLIENT_NAME ;
const hasuraAdminSecret = process.env.HASURA_ADMIN_SECRET ;
// Creating an Axios instance with custom headers // Creating an Axios instance with custom headers
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: TARGET_URL, baseURL: TARGET_URL,
headers: { headers: {
"x-hasura-admin-secret": "myadminsecretkey", "x-hasura-admin-secret": hasuraAdminSecret,
"Hasura-Client-Name": "hasura-console" "Hasura-Client-Name": hasuraClientName
// Add any other headers you need // Add any other headers you need
}, },
}); });
......
import axios from "axios"; import axios from "axios";
import async from "async"; import async from "async";
const targetURL = process.env.TARGET_URL || "https://hasura.upsmfac.org"; const targetURL = process.env.TARGET_URL;
const REACT_APP_NODE_URL = process.env.REACT_APP_API_URL || "https://uphrh.in/api/api"; const REACT_APP_NODE_URL = process.env.REACT_APP_API_URL;
const AUTH_TOKEN = process.env.REACT_APP_AUTH_TOKEN; const AUTH_TOKEN = process.env.REACT_APP_AUTH_TOKEN;
const getBulkUploadAssessorSchedule = '/api/rest/getBulkUploadAssessorSchedule'; const getBulkUploadAssessorSchedule = '/api/rest/getBulkUploadAssessorSchedule';
...@@ -16,12 +16,15 @@ const updateStatusToBulkUpload = '/api/rest/updateStatusToBulkUpload'; ...@@ -16,12 +16,15 @@ const updateStatusToBulkUpload = '/api/rest/updateStatusToBulkUpload';
const getAllAssessorsAPI = '/api/rest/getAllAssessors'; const getAllAssessorsAPI = '/api/rest/getAllAssessors';
const getAdminDetailsById = '/api/rest/getRegulator'; const getAdminDetailsById = '/api/rest/getRegulator';
const hasuraClientName = process.env.HASURA_CLIENT_NAME ;
const hasuraAdminSecret = process.env.HASURA_ADMIN_SECRET ;
// Creating an Axios instance with custom headers // Creating an Axios instance with custom headers
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: targetURL, baseURL: targetURL,
headers: { headers: {
"x-hasura-admin-secret": "myadminsecretkey", "x-hasura-admin-secret": hasuraAdminSecret,
"Hasura-Client-Name": "hasura-console" "Hasura-Client-Name": hasuraClientName
// Add any other headers you need // Add any other headers you need
}, },
}); });
......
...@@ -26,14 +26,17 @@ app.use(express.json()); ...@@ -26,14 +26,17 @@ app.use(express.json());
app.use(express.urlencoded({ extended: true })); app.use(express.urlencoded({ extended: true }));
const port = process.env.PORT || 3000; const port = process.env.PORT || 3000;
const targetURL = process.env.TARGET_URL || "https://hasura.upsmfac.org"; const targetURL = process.env.TARGET_URL ;
const hasuraClientName = process.env.HASURA_CLIENT_NAME ;
const hasuraAdminSecret = process.env.HASURA_ADMIN_SECRET ;
const REACT_APP_NODE_URL = process.env.REACT_APP_API_URL;
// Creating an Axios instance with custom headers // Creating an Axios instance with custom headers
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: targetURL, baseURL: targetURL,
headers: { headers: {
"x-hasura-admin-secret": "myadminsecretkey", "x-hasura-admin-secret": hasuraAdminSecret,
"Hasura-Client-Name": "hasura-console" "Hasura-Client-Name": hasuraClientName
// Add any other headers you need // Add any other headers you need
}, },
}); });
...@@ -46,8 +49,8 @@ endpoints.forEach((endpoint) => { ...@@ -46,8 +49,8 @@ endpoints.forEach((endpoint) => {
target: targetURL, target: targetURL,
changeOrigin: true, changeOrigin: true,
onProxyReq: (proxyReq, req, res) => { onProxyReq: (proxyReq, req, res) => {
proxyReq.setHeader("x-hasura-admin-secret", "myadminsecretkey"); proxyReq.setHeader("x-hasura-admin-secret",hasuraAdminSecret);
proxyReq.setHeader("Hasura-Client-Name", "hasura-console"); proxyReq.setHeader("Hasura-Client-Name", hasuraClientName);
if (endpoint.requestBody) { if (endpoint.requestBody) {
const bodyData = JSON.stringify(req.body); const bodyData = JSON.stringify(req.body);
proxyReq.setHeader("Content-Length", Buffer.byteLength(bodyData)); proxyReq.setHeader("Content-Length", Buffer.byteLength(bodyData));
...@@ -120,7 +123,7 @@ app.post("/payment/v2/generatelink", async (req, res) => { ...@@ -120,7 +123,7 @@ app.post("/payment/v2/generatelink", async (req, res) => {
let config = { let config = {
method: "put", method: "put",
maxBodyLength: Infinity, maxBodyLength: Infinity,
url: "https://uphrh.in/api/api/rest/saveTransactionRecord", url: REACT_APP_NODE_URL+"/rest/saveTransactionRecord",
headers: { headers: {
Authorization: "Bearer " + process.env.Authorization, Authorization: "Bearer " + process.env.Authorization,
}, },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment