Skip to content

Commit f1af8fc

Browse files
committed
refactor: use environment config for execution engine URL
1 parent 4d478b7 commit f1af8fc

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

src/component/modals/ContributeDetails.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react';
22
import { toast } from 'react-toastify';
33
import axios from 'axios';
4+
import { EXECUTION_ENGINE_URL } from '../../serverCon/config';
45
import Modal from './ParentModal';
56
import { actionType as T } from '../../reducer';
67
import './contributeDetails.css';
@@ -24,7 +25,7 @@ const ContributeDetails = ({ superState, dispatcher }) => {
2425
const id = toast.loading('Processing your Request.Please wait...');
2526
try {
2627
e.preventDefault();
27-
const result = await axios.post('http://127.0.0.1:5000/contribute', {
28+
const result = await axios.post(`${EXECUTION_ENGINE_URL}/contribute`, {
2829
study,
2930
auth,
3031
desc,

src/graph-builder/graph-core/6-server.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { toast } from 'react-toastify';
22
import Axios from 'axios';
33
import { actionType as T } from '../../reducer';
4+
import { EXECUTION_ENGINE_URL } from '../../serverCon/config';
45
import GraphLoadSave from './5-load-save';
56
// import {
67
// postGraph, updateGraph, forceUpdateGraph, getGraph, getGraphWithHashCheck,
@@ -73,7 +74,7 @@ class GraphServer extends GraphLoadSave {
7374
autoClose: false,
7475
});
7576
this.dispatcher({ type: T.SET_LOGS, payload: false });
76-
Axios.post(`http://127.0.0.1:5000/build/${this.superState.uploadedDirName}?fetch=${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}&unlock=${this.superState.unlockCheck}&docker=${this.superState.dockerCheck}&maxtime=${this.superState.maxTime}&params=${this.superState.params}&octave=${this.superState.octave}`)
77+
Axios.post(`${EXECUTION_ENGINE_URL}/build/${this.superState.uploadedDirName}?fetch=${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}&unlock=${this.superState.unlockCheck}&docker=${this.superState.dockerCheck}&maxtime=${this.superState.maxTime}&params=${this.superState.params}&octave=${this.superState.octave}`)
7778
.then((res) => { // eslint-disable-next-line
7879
toast.success(res.data['message']);
7980
this.dispatcher({
@@ -98,7 +99,7 @@ class GraphServer extends GraphLoadSave {
9899
autoClose: false,
99100
});
100101
this.dispatcher({ type: T.SET_LOGS, payload: false });
101-
Axios.post(`http://127.0.0.1:5000/debug/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
102+
Axios.post(`${EXECUTION_ENGINE_URL}/debug/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
102103
.then((res) => { // eslint-disable-next-line
103104
toast.success(res.data['message'])
104105
this.dispatcher({
@@ -122,7 +123,7 @@ class GraphServer extends GraphLoadSave {
122123
autoClose: false,
123124
});
124125
this.dispatcher({ type: T.SET_LOGS, payload: false });
125-
Axios.post(`http://127.0.0.1:5000/run/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
126+
Axios.post(`${EXECUTION_ENGINE_URL}/run/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
126127
.then((res) => { // eslint-disable-next-line
127128
toast.success(res.data['message'])
128129
this.dispatcher({
@@ -146,7 +147,7 @@ class GraphServer extends GraphLoadSave {
146147
autoClose: false,
147148
});
148149
this.dispatcher({ type: T.SET_LOGS, payload: false });
149-
Axios.post(`http://127.0.0.1:5000/clear/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}
150+
Axios.post(`${EXECUTION_ENGINE_URL}/clear/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}
150151
?unlock=${this.superState.unlockCheck}&maxtime=${this.superState.maxTime}&params=${this.superState.params}`)
151152
.then((res) => { // eslint-disable-next-line
152153
toast.success(res.data['message']);
@@ -171,7 +172,7 @@ class GraphServer extends GraphLoadSave {
171172
autoClose: false,
172173
});
173174
this.dispatcher({ type: T.SET_LOGS, payload: false });
174-
Axios.post(`http://127.0.0.1:5000/stop/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
175+
Axios.post(`${EXECUTION_ENGINE_URL}/stop/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
175176
.then((res) => { // eslint-disable-next-line
176177
toast.success(res.data['message'])
177178
this.dispatcher({
@@ -195,7 +196,7 @@ class GraphServer extends GraphLoadSave {
195196
autoClose: false,
196197
});
197198
this.dispatcher({ type: T.SET_LOGS, payload: false });
198-
Axios.delete(`http://127.0.0.1:5000/destroy/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
199+
Axios.delete(`${EXECUTION_ENGINE_URL}/destroy/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
199200
.then((res) => { // eslint-disable-next-line
200201
toast.success(res.data['message'])
201202
this.dispatcher({
@@ -219,7 +220,7 @@ class GraphServer extends GraphLoadSave {
219220
autoClose: false,
220221
});
221222
// this.dispatcher({ type: T.SET_LOGS, payload: false });
222-
Axios.post(`http://127.0.0.1:5000/library/${this.superState.uploadedDirName}?filename=${fileName}&path=${this.superState.library}`)
223+
Axios.post(`${EXECUTION_ENGINE_URL}/library/${this.superState.uploadedDirName}?filename=${fileName}&path=${this.superState.library}`)
223224
.then((res) => { // eslint-disable-next-line
224225
toast.info(res.data['message'])
225226
toast.dismiss(toastId);

src/serverCon/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const EXECUTION_ENGINE_URL = process.env.REACT_APP_EXECUTION_ENGINE_URL || 'http://127.0.0.1:5000';
2+
13
export default {
24
baseURL: 'http://localhost:8000/',
35
getGraph: (id) => `workflow/${id}`,

0 commit comments

Comments
 (0)