[ch6331] | Abhishek | Remove hardcoded URLs and add to env files

This commit is contained in:
Abhishek Katiyar
2020-05-22 10:29:14 +05:30
parent e3d24f7058
commit ec66046cfd
7 changed files with 11 additions and 9 deletions

3
.env Normal file
View File

@@ -0,0 +1,3 @@
REACT_APP_OKTA_URL=https://navi-2020.okta.com
REACT_APP_BACKEND_URL=http://localhost:8080
REACT_APP_CLIENT_ID=0oaa0a9up1F7lQc5A4x6

View File

@@ -2,7 +2,6 @@
"name": "ops-portal",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
@@ -24,7 +23,6 @@
"@types/react-dom": "^16.9.0",
"formik": "^2.1.4",
"formik-material-ui": "^2.0.0-beta.1",
"global": "^4.4.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-redux": "^7.2.0",
@@ -60,6 +58,7 @@
"awesome-typescript-loader": "^5.2.1",
"copy-webpack-plugin": "^5.0.5",
"css-loader": "^3.2.0",
"dotenv": "^8.2.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^6.7.2",

View File

@@ -9,11 +9,11 @@ import Dashboard from "./components/Dashboard";
import AddLayout from "./components/admin/editform/AddLayout";
const config = {
issuer: 'https://navi-2020.okta.com',
issuer: process.env.REACT_APP_OKTA_URL,
redirectUri: window.location.origin+'/implicit/callback',
responseType: 'id_token',
scope: 'openid groups',
clientId: "0oaa0a9up1F7lQc5A4x6",
clientId: process.env.REACT_APP_CLIENT_ID,
};
function App() {

View File

@@ -37,7 +37,7 @@ export default function MenuAppBar(props:any) {
const open1 = Boolean(anchorEl1);
const {authState, authService} = useOktaAuth();
const issuer= 'https://navi-2020.okta.com';
const issuer= process.env.REACT_APP_OKTA_URL;
const redirectUri= window.location.origin+'/logged_out';
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setAuth(event.target.checked);

View File

@@ -50,8 +50,8 @@ const Form = () => {
const handleSubmit = async (values: any ): Promise<void> => {
console.log(values);
fetch('http://localhost:9090/manifest', {
const backendURL = `${process.env.REACT_APP_BACKEND_URL}`
fetch(backendURL, {
method: 'POST',
headers: {
Accept: 'application/json',

View File

@@ -52,7 +52,7 @@ const ShowDeploymentManifest = () => {
console.log("...." + serviceName + environment);
const {idToken} = authState;
fetch(
`http://localhost:9090/manifest/${serviceName}/${environment}`,
`${process.env.REACT_APP_BACKEND_URL}/manifest/${serviceName}/${environment}`,
{
method: 'GET',
headers: {

View File

@@ -4263,7 +4263,7 @@ dotenv-expand@5.1.0:
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
dotenv@8.2.0:
dotenv@8.2.0, dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==