chore(web): Remove API url env variable
This commit is contained in:
@@ -720,6 +720,7 @@ type ListSamlAuthProvider {
|
||||
id: String
|
||||
name: String
|
||||
issuer: String
|
||||
loginUrl: String
|
||||
}
|
||||
|
||||
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 {
|
||||
const callbackUrl = new URL(
|
||||
`/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;
|
||||
defaultRoleId: string;
|
||||
active: boolean;
|
||||
loginUrl: string;
|
||||
};
|
||||
|
||||
type AppConfig = {
|
||||
@@ -437,7 +438,7 @@ type AppConfig = {
|
||||
canCustomConnect: boolean;
|
||||
shared: boolean;
|
||||
disabled: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
type AppAuthClient = {
|
||||
id: string;
|
||||
@@ -445,7 +446,7 @@ type AppAuthClient = {
|
||||
appConfigId: string;
|
||||
authDefaults: string;
|
||||
formattedAuthDefaults: IJSONObject;
|
||||
}
|
||||
};
|
||||
|
||||
declare module 'axios' {
|
||||
interface AxiosResponse {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
PORT=3001
|
||||
REACT_APP_API_URL=http://localhost:3000
|
||||
REACT_APP_GRAPHQL_URL=http://localhost:3000/graphql
|
||||
# HTTPS=true
|
||||
REACT_APP_BASE_URL=http://localhost:3001
|
||||
|
@@ -24,7 +24,7 @@ function SsoProviders() {
|
||||
<Button
|
||||
key={provider.id}
|
||||
component="a"
|
||||
href={URLS.SSO_LOGIN(provider.issuer)}
|
||||
href={provider.loginUrl}
|
||||
variant="outlined"
|
||||
>
|
||||
{formatMessage('ssoProviders.loginWithProvider', {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
type Config = {
|
||||
[key: string]: string;
|
||||
baseUrl: string;
|
||||
apiUrl: string;
|
||||
graphqlUrl: string;
|
||||
notificationsUrl: string;
|
||||
chatwootBaseUrl: string;
|
||||
@@ -10,17 +9,10 @@ type Config = {
|
||||
|
||||
const config: Config = {
|
||||
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,
|
||||
notificationsUrl: process.env.REACT_APP_NOTIFICATIONS_URL as string,
|
||||
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;
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import appConfig from './app';
|
||||
|
||||
export const CONNECTIONS = '/connections';
|
||||
export const EXECUTIONS = '/executions';
|
||||
export const EXECUTION_PATTERN = '/executions/:executionId';
|
||||
@@ -7,8 +5,6 @@ export const EXECUTION = (executionId: string) => `/executions/${executionId}`;
|
||||
|
||||
export const LOGIN = '/login';
|
||||
export const LOGIN_CALLBACK = `${LOGIN}/callback`;
|
||||
export const SSO_LOGIN = (issuer: string) =>
|
||||
`${appConfig.apiUrl}/login/saml/${issuer}`;
|
||||
export const SIGNUP = '/sign-up';
|
||||
export const FORGOT_PASSWORD = '/forgot-password';
|
||||
export const RESET_PASSWORD = '/reset-password';
|
||||
|
@@ -5,6 +5,7 @@ export const LIST_SAML_AUTH_PROVIDERS = gql`
|
||||
listSamlAuthProviders {
|
||||
id
|
||||
name
|
||||
loginUrl
|
||||
issuer
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user