Skip to content

Commit 019d7ea

Browse files
committed
feat: add support for multiple runtime modes (MSW and Server) in the console application
1 parent 9a1a79b commit 019d7ea

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

apps/console/.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
VITE_RUNTIME_MODE=msw
99

1010
# ObjectStack Server URL (used when VITE_RUNTIME_MODE=server)
11-
# VITE_SERVER_URL=http://localhost:5000/api/v1
11+
# Note: This should be the server root URL, not including /api/v1
12+
# The client adds /api/v1/... internally
13+
# VITE_SERVER_URL=http://localhost:5000

apps/console/src/lib/config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ export interface ConsoleConfig {
1818

1919
/**
2020
* Server base URL (used in 'server' mode)
21-
* @default 'http://localhost:5000/api/v1'
21+
* This should be the server root, not including /api/v1
22+
* @default 'http://localhost:5000'
2223
*/
2324
serverUrl: string;
2425

2526
/**
2627
* MSW API base path (used in 'msw' mode)
27-
* @default '/api/v1'
28+
* This should be empty string since client adds /api/v1/... internally
29+
* @default ''
2830
*/
2931
mswBasePath: string;
3032
}
@@ -48,8 +50,8 @@ function getRuntimeMode(): RuntimeMode {
4850
*/
4951
const defaultConfig: ConsoleConfig = {
5052
mode: getRuntimeMode(),
51-
serverUrl: import.meta.env.VITE_SERVER_URL || 'http://localhost:5000/api/v1',
52-
mswBasePath: '/api/v1',
53+
serverUrl: import.meta.env.VITE_SERVER_URL || 'http://localhost:5000',
54+
mswBasePath: '', // Empty - client adds /api/v1/... internally
5355
};
5456

5557
/**

0 commit comments

Comments
 (0)