Skip to content

Commit 54d3d70

Browse files
committed
feat: provide BASE_URL config to demo set up
1 parent 2e97a9a commit 54d3d70

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/catalog-server/lib/api.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import axios from 'axios';
22
import { errorCode } from '@vulcan-sql/catalog-server/utils/errorCode';
3+
import getConfig from 'next/config';
4+
5+
const { publicRuntimeConfig } = getConfig();
36

47
enum API {
58
Login = '/api/auth/login',
@@ -22,7 +25,7 @@ const handleError = ({ statusCode, errorMessage }) => {
2225
};
2326

2427
export const axiosInstance = axios.create({
25-
baseURL: process.env.API_URL || 'http://localhost:4200',
28+
baseURL: publicRuntimeConfig.baseUrl,
2629
responseType: 'json',
2730
timeout: 30000,
2831
headers: {

packages/catalog-server/lib/apollo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { setContext } from '@apollo/client/link/context';
88

99
const httpLink = createHttpLink({
10-
uri: process.env.GQL_API_URL || 'http://localhost:4200/api/graphql',
10+
uri: '/api/graphql',
1111
});
1212

1313
const authLink = setContext((_, { headers }) => {

packages/catalog-server/next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const nextConfig = {
1212
compiler: {
1313
styledComponents: true,
1414
},
15+
publicRuntimeConfig: {
16+
baseUrl: process.env.BASE_URL || 'http://localhost:4200',
17+
},
1518
serverRuntimeConfig: {
1619
// Will only be available on the server side
1720
vulcanSQLHost: process.env.VULCAN_SQL_HOST || 'http://localhost:3000',

0 commit comments

Comments
 (0)