chore(web): Remove API url env variable
This commit is contained in:
@@ -720,6 +720,7 @@ type ListSamlAuthProvider {
|
|||||||
id: String
|
id: String
|
||||||
name: String
|
name: String
|
||||||
issuer: String
|
issuer: String
|
||||||
|
loginUrl: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type Permission {
|
type Permission {
|
||||||
|
@@ -75,6 +75,14 @@ class SamlAuthProvider extends Base {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static get virtualAttributes() {
|
||||||
|
return ['loginUrl'];
|
||||||
|
}
|
||||||
|
|
||||||
|
get loginUrl() {
|
||||||
|
return new URL(`/login/saml/${this.issuer}`, appConfig.baseUrl).toString();
|
||||||
|
}
|
||||||
|
|
||||||
get config(): SamlConfig {
|
get config(): SamlConfig {
|
||||||
const callbackUrl = new URL(
|
const callbackUrl = new URL(
|
||||||
`/login/saml/${this.issuer}/callback`,
|
`/login/saml/${this.issuer}/callback`,
|
||||||
|
5
packages/types/index.d.ts
vendored
5
packages/types/index.d.ts
vendored
@@ -427,6 +427,7 @@ type TSamlAuthProvider = {
|
|||||||
roleAttributeName: string;
|
roleAttributeName: string;
|
||||||
defaultRoleId: string;
|
defaultRoleId: string;
|
||||||
active: boolean;
|
active: boolean;
|
||||||
|
loginUrl: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type AppConfig = {
|
type AppConfig = {
|
||||||
@@ -437,7 +438,7 @@ type AppConfig = {
|
|||||||
canCustomConnect: boolean;
|
canCustomConnect: boolean;
|
||||||
shared: boolean;
|
shared: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
type AppAuthClient = {
|
type AppAuthClient = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -445,7 +446,7 @@ type AppAuthClient = {
|
|||||||
appConfigId: string;
|
appConfigId: string;
|
||||||
authDefaults: string;
|
authDefaults: string;
|
||||||
formattedAuthDefaults: IJSONObject;
|
formattedAuthDefaults: IJSONObject;
|
||||||
}
|
};
|
||||||
|
|
||||||
declare module 'axios' {
|
declare module 'axios' {
|
||||||
interface AxiosResponse {
|
interface AxiosResponse {
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
PORT=3001
|
PORT=3001
|
||||||
REACT_APP_API_URL=http://localhost:3000
|
|
||||||
REACT_APP_GRAPHQL_URL=http://localhost:3000/graphql
|
REACT_APP_GRAPHQL_URL=http://localhost:3000/graphql
|
||||||
# HTTPS=true
|
# HTTPS=true
|
||||||
REACT_APP_BASE_URL=http://localhost:3001
|
REACT_APP_BASE_URL=http://localhost:3001
|
||||||
|
@@ -24,7 +24,7 @@ function SsoProviders() {
|
|||||||
<Button
|
<Button
|
||||||
key={provider.id}
|
key={provider.id}
|
||||||
component="a"
|
component="a"
|
||||||
href={URLS.SSO_LOGIN(provider.issuer)}
|
href={provider.loginUrl}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
>
|
>
|
||||||
{formatMessage('ssoProviders.loginWithProvider', {
|
{formatMessage('ssoProviders.loginWithProvider', {
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
type Config = {
|
type Config = {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
apiUrl: string;
|
|
||||||
graphqlUrl: string;
|
graphqlUrl: string;
|
||||||
notificationsUrl: string;
|
notificationsUrl: string;
|
||||||
chatwootBaseUrl: string;
|
chatwootBaseUrl: string;
|
||||||
@@ -10,17 +9,10 @@ type Config = {
|
|||||||
|
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
baseUrl: process.env.REACT_APP_BASE_URL as string,
|
baseUrl: process.env.REACT_APP_BASE_URL as string,
|
||||||
apiUrl: process.env.REACT_APP_API_URL as string,
|
|
||||||
graphqlUrl: process.env.REACT_APP_GRAPHQL_URL as string,
|
graphqlUrl: process.env.REACT_APP_GRAPHQL_URL as string,
|
||||||
notificationsUrl: process.env.REACT_APP_NOTIFICATIONS_URL as string,
|
notificationsUrl: process.env.REACT_APP_NOTIFICATIONS_URL as string,
|
||||||
chatwootBaseUrl: 'https://app.chatwoot.com',
|
chatwootBaseUrl: 'https://app.chatwoot.com',
|
||||||
supportEmailAddress: 'support@automatisch.io'
|
supportEmailAddress: 'support@automatisch.io',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!config.apiUrl && !config.graphqlUrl) {
|
|
||||||
config.apiUrl = '/';
|
|
||||||
} else if (!config.apiUrl) {
|
|
||||||
config.apiUrl = (new URL(config.graphqlUrl)).origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import appConfig from './app';
|
|
||||||
|
|
||||||
export const CONNECTIONS = '/connections';
|
export const CONNECTIONS = '/connections';
|
||||||
export const EXECUTIONS = '/executions';
|
export const EXECUTIONS = '/executions';
|
||||||
export const EXECUTION_PATTERN = '/executions/:executionId';
|
export const EXECUTION_PATTERN = '/executions/:executionId';
|
||||||
@@ -7,8 +5,6 @@ export const EXECUTION = (executionId: string) => `/executions/${executionId}`;
|
|||||||
|
|
||||||
export const LOGIN = '/login';
|
export const LOGIN = '/login';
|
||||||
export const LOGIN_CALLBACK = `${LOGIN}/callback`;
|
export const LOGIN_CALLBACK = `${LOGIN}/callback`;
|
||||||
export const SSO_LOGIN = (issuer: string) =>
|
|
||||||
`${appConfig.apiUrl}/login/saml/${issuer}`;
|
|
||||||
export const SIGNUP = '/sign-up';
|
export const SIGNUP = '/sign-up';
|
||||||
export const FORGOT_PASSWORD = '/forgot-password';
|
export const FORGOT_PASSWORD = '/forgot-password';
|
||||||
export const RESET_PASSWORD = '/reset-password';
|
export const RESET_PASSWORD = '/reset-password';
|
||||||
|
@@ -5,6 +5,7 @@ export const LIST_SAML_AUTH_PROVIDERS = gql`
|
|||||||
listSamlAuthProviders {
|
listSamlAuthProviders {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
loginUrl
|
||||||
issuer
|
issuer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user