the statusphere demo reworked into a vite/react app in a monorepo

use PUBLIC_URL in prod

Changed files
+4 -3
packages
appview
src
auth
+4 -3
packages/appview/src/auth/client.ts
··· 8 8 // Get the ngrok URL from environment variables 9 9 const ngrokUrl = env.NGROK_URL 10 10 11 - if (!ngrokUrl) { 11 + if (!ngrokUrl && env.NODE_ENV === 'development') { 12 12 console.warn( 13 13 'WARNING: NGROK_URL is not set. OAuth login might not work properly.', 14 14 ) ··· 16 16 'You should run ngrok and set the NGROK_URL environment variable.', 17 17 ) 18 18 console.warn('Example: NGROK_URL=https://abcd-123-45-678-90.ngrok.io') 19 + } else if (env.NODE_ENV === 'production' && !env.PUBLIC_URL) { 20 + throw new Error('PUBLIC_URL is not set') 19 21 } 20 22 21 - // The base URL is either the ngrok URL (preferred) or a local URL as fallback 22 - const baseUrl = ngrokUrl || `http://127.0.0.1:${env.PORT}` 23 + const baseUrl = ngrokUrl || env.PUBLIC_URL || `http://127.0.0.1:${env.PORT}` 23 24 24 25 return new NodeOAuthClient({ 25 26 clientMetadata: {