Skip to content

Commit 726864e

Browse files
committed
Add development environment configuration for Console app
1 parent 0f40b41 commit 726864e

24 files changed

+59
-2000
lines changed

apps/console/.env.development

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Development: connect to a local or remote ObjectStack server.
2+
# Set VITE_SERVER_URL to your dev server (e.g. http://localhost:3000 or https://demo.objectstack.ai).
3+
# Leave empty to use same-origin (when Console is served by the server itself).
4+
VITE_SERVER_URL=http://localhost:3000
5+
VITE_USE_MOCK_SERVER=false

apps/console/.env.production

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
# Production: connect to the ObjectStack server.
2+
# Set VITE_SERVER_URL to the server origin, or leave empty for same-origin.
3+
VITE_SERVER_URL=
14
VITE_USE_MOCK_SERVER=false

apps/console/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"@objectstack/driver-memory": "^4.0.3",
7474
"@objectstack/objectql": "^4.0.3",
7575
"@objectstack/plugin-msw": "^4.0.3",
76+
"@objectstack/plugin-auth": "^4.0.3",
7677
"@objectstack/plugin-setup": "^4.0.3",
7778
"@objectstack/runtime": "^4.0.3",
7879
"@objectstack/spec": "^4.0.3",

apps/console/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export function App() {
518518
return (
519519
<ThemeProvider defaultTheme="system" storageKey="object-ui-theme">
520520
<ConsoleToaster position="bottom-right" />
521-
<ConditionalAuthWrapper authUrl="/api/v1/auth">
521+
<ConditionalAuthWrapper authUrl={`${import.meta.env.VITE_SERVER_URL || ''}/api/v1/auth`}>
522522
<PreviewBanner />
523523
<NavigationProvider>
524524
<FavoritesProvider>

apps/console/src/components/ConditionalAuthWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function ConditionalAuthWrapper({ children, authUrl }: ConditionalAuthWra
4242
// Empty baseUrl allows the adapter to use browser-relative paths
4343
// This works because the console app is served from the same origin as the API
4444
const adapter = new ObjectStackAdapter({
45-
baseUrl: '',
45+
baseUrl: import.meta.env.VITE_SERVER_URL || '',
4646
autoReconnect: false,
4747
});
4848

apps/console/src/context/AdapterProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function AdapterProvider({ children, adapter: externalAdapter }: AdapterP
4343
async function init() {
4444
try {
4545
const a = new ObjectStackAdapter({
46-
baseUrl: '',
46+
baseUrl: import.meta.env.VITE_SERVER_URL || '',
4747
autoReconnect: true,
4848
maxReconnectAttempts: 5,
4949
reconnectDelay: 1000,

apps/console/vite.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,17 @@ export default defineConfig({
277277
}
278278
},
279279
server: {
280-
// Proxy API requests to the real ObjectStack server when running in server mode.
280+
// Proxy API requests to the ObjectStack server (local or remote).
281+
// Configure via VITE_SERVER_URL env var; defaults to http://localhost:3000.
281282
// In MSW mode, MSW intercepts requests at the service worker level before they
282283
// reach the network, so these proxies are effectively bypassed.
283284
proxy: {
284285
'/api': {
285-
target: 'http://localhost:3000',
286+
target: process.env.VITE_SERVER_URL || 'http://localhost:3000',
286287
changeOrigin: true,
287288
},
288289
'/.well-known/objectstack': {
289-
target: 'http://localhost:3000',
290+
target: process.env.VITE_SERVER_URL || 'http://localhost:3000',
290291
changeOrigin: true,
291292
},
292293
},

apps/server/.env.example

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/server/.gitignore

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/server/.vercelignore

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)