Add HYDRA_PUBLIC_URL env variable and fix replace of sing out url
This commit is contained in:
parent
3f455aedd9
commit
d0b86c0809
2 changed files with 5 additions and 2 deletions
|
@ -1 +1,2 @@
|
||||||
REACT_APP_API_URL=http://stackspin_proxy:8081/api/v1
|
REACT_APP_API_URL=http://stackspin_proxy:8081/api/v1
|
||||||
|
REACT_APP_HYDRA_PUBLIC_URL=https://sso.init.stackspin.net
|
|
@ -9,6 +9,8 @@ import _ from 'lodash';
|
||||||
|
|
||||||
import { UserModal } from '../UserModal';
|
import { UserModal } from '../UserModal';
|
||||||
|
|
||||||
|
const HYDRA_LOGOUT_URL = `${process.env.REACT_APP_HYDRA_PUBLIC_URL}/oauth2/sessions/logout`;
|
||||||
|
|
||||||
const navigation = [
|
const navigation = [
|
||||||
{ name: 'Dashboard', to: '/dashboard', requiresAdmin: false },
|
{ name: 'Dashboard', to: '/dashboard', requiresAdmin: false },
|
||||||
{ name: 'Users', to: '/users', requiresAdmin: true },
|
{ name: 'Users', to: '/users', requiresAdmin: true },
|
||||||
|
@ -52,9 +54,9 @@ const Header: React.FC<HeaderProps> = () => {
|
||||||
const { hostname } = window.location;
|
const { hostname } = window.location;
|
||||||
// If we are developing locally, we need to use the init cluster's public URL
|
// If we are developing locally, we need to use the init cluster's public URL
|
||||||
if (hostname === 'localhost') {
|
if (hostname === 'localhost') {
|
||||||
return `https://sso.init.stackspin.net/oauth2/sessions/logout`;
|
return HYDRA_LOGOUT_URL;
|
||||||
}
|
}
|
||||||
return `https://${hostname.replace('dashboard', 'sso')}/oauth2/sessions/logout`;
|
return `https://${hostname.replace(/^dashboard/, 'sso')}/oauth2/sessions/logout`;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue