Skip to content

Commit

Permalink
422 Prefixes default URLs with the word PREFIX and using the default …
Browse files Browse the repository at this point in the history
…url in the api client context
  • Loading branch information
ricardovdheijden committed Nov 8, 2023
1 parent bec2568 commit 8a07766
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import process from 'process';
import { Environment, OrchestratorConfig } from '../hooks';
import { getNumberValueFromEnvironmentVariable } from '../utils';

export const GRAPHQL_ENDPOINT_CORE = 'http://localhost:8080/api/graphql';
export const ORCHESTRATOR_API_BASE_URL = 'http://localhost:8080/api';
export const DEFAULT_GRAPHQL_CORE_ENDPOINT =
'http://localhost:8080/api/graphql';
export const DEFAULT_ORCHESTRATOR_API_BASE_URL = 'http://localhost:8080/api';

export const ENGINE_STATUS_ENDPOINT = '/settings/status';
export const PROCESS_STATUS_COUNTS_ENDPOINT = '/processes/status-counts';
Expand All @@ -18,12 +19,12 @@ export const getInitialOrchestratorConfig = (): OrchestratorConfig => {
process.env.ORCHESTRATOR_GRAPHQL_HOST &&
process.env.ORCHESTRATOR_GRAPHQL_PATH
? `${process.env.ORCHESTRATOR_GRAPHQL_HOST}${process.env.ORCHESTRATOR_GRAPHQL_PATH}`
: GRAPHQL_ENDPOINT_CORE;
: DEFAULT_GRAPHQL_CORE_ENDPOINT;

const orchestratorApiBaseUrl =
process.env.ORCHESTRATOR_API_HOST && process.env.ORCHESTRATOR_API_PATH
? `${process.env.ORCHESTRATOR_API_HOST}${process.env.ORCHESTRATOR_API_PATH}`
: ORCHESTRATOR_API_BASE_URL;
: DEFAULT_ORCHESTRATOR_API_BASE_URL;

return {
orchestratorApiBaseUrl,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { createContext, useState, useEffect } from 'react';
import type { ReactNode } from 'react';
import { ApiClient, getApiClient } from '../api';
import { DEFAULT_ORCHESTRATOR_API_BASE_URL } from '../configuration';

interface ApiContext {
apiClient: ApiClient;
}

// Todo replace this magic string when configuration.ts is moved to package
export const ApiClientContext = createContext<ApiContext>({
apiClient: getApiClient('http://localhost:8080/api'),
apiClient: getApiClient(DEFAULT_ORCHESTRATOR_API_BASE_URL),
});

export type ApiClientContextProviderProps = {
Expand Down

0 comments on commit 8a07766

Please sign in to comment.