Skip to content

Deployment tips on wso2 dev platform doc.#134

Open
yasandu0505 wants to merge 1 commit into
LDFLK:mainfrom
yasandu0505:docs
Open

Deployment tips on wso2 dev platform doc.#134
yasandu0505 wants to merge 1 commit into
LDFLK:mainfrom
yasandu0505:docs

Conversation

@yasandu0505
Copy link
Copy Markdown
Contributor

No description provided.

@yasandu0505 yasandu0505 requested a review from ChanukaUOJ May 9, 2026 10:45
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new documentation file, DEPLOYMENT.md, which details the runtime configuration pattern for Vite-based React applications on the WSO2 Developer Platform. The guide explains how to bypass Vite's build-time environment variable substitution by using a runtime config.js file. The review feedback focuses on improving the accuracy and consistency of the documentation, specifically by correcting file paths, fixing step numbering, adding missing configuration fields to examples, and suggesting the use of relative imports to ensure compatibility.

</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The entry point script path in the documentation (/src/main.tsx) does not match the actual file in the repository (/src/index.tsx).

Suggested change
<script type="module" src="/src/main.tsx"></script>
<script type="module" src="/src/index.tsx"></script>

Comment on lines +135 to +153
const runtimeEnv = (window as any).__ENV__ ?? {};

export const config = {
ASGARDEO_CLIENT_ID:
runtimeEnv.VITE_ASGARDEO_CLIENT_ID ||
import.meta.env.VITE_ASGARDEO_CLIENT_ID,

ASGARDEO_BASE_URL:
runtimeEnv.VITE_ASGARDEO_BASE_URL ||
import.meta.env.VITE_ASGARDEO_BASE_URL,

RTI_TRACKER_SERVER_URL:
runtimeEnv.VITE_RTI_TRACKER_SERVER_URL ||
import.meta.env.VITE_RTI_TRACKER_SERVER_URL,

FILE_STORAGE_BASE_URL:
runtimeEnv.VITE_FILE_STORAGE_BASE_URL ||
import.meta.env.VITE_FILE_STORAGE_BASE_URL,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration example is missing the FILE_VIEW_BASE_URL field found in the actual implementation. Additionally, using env and || matches the existing code in src/config.ts more closely for consistency.

const env = (window as any).__ENV__ || {};

export const config = {
  ASGARDEO_CLIENT_ID:
    env.VITE_ASGARDEO_CLIENT_ID ||
    import.meta.env.VITE_ASGARDEO_CLIENT_ID,

  ASGARDEO_BASE_URL:
    env.VITE_ASGARDEO_BASE_URL ||
    import.meta.env.VITE_ASGARDEO_BASE_URL,

  RTI_TRACKER_SERVER_URL:
    env.VITE_RTI_TRACKER_SERVER_URL ||
    import.meta.env.VITE_RTI_TRACKER_SERVER_URL,

  FILE_STORAGE_BASE_URL:
    env.VITE_FILE_STORAGE_BASE_URL ||
    import.meta.env.VITE_FILE_STORAGE_BASE_URL,

  FILE_VIEW_BASE_URL:
    env.VITE_FILE_VIEW_BASE_URL ||
    import.meta.env.VITE_FILE_VIEW_BASE_URL,
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add VITE_FILE_VIEW_BASE_URL as well


---

### Step 4 — Replace all `import.meta.env` usages in your app
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The step numbering is incorrect; Step 3 is skipped in the sequence.

Suggested change
### Step 4 — Replace all `import.meta.env` usages in your app
### Step 3 — Replace all `import.meta.env` usages in your app

const clientId = import.meta.env.VITE_ASGARDEO_CLIENT_ID;

// After
import { config } from '@/config';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The project appears to use relative imports (e.g., in App.tsx). Using the @/ alias might cause build issues if it is not explicitly configured in the environment.

Suggested change
import { config } from '@/config';
import { config } from './config';


---

### Step 5 — Your local `.env` still works as-is
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The step numbering should be updated to maintain a proper sequence following the previous correction.

Suggested change
### Step 5 — Your local `.env` still works as-is
### Step 4 — Your local `.env` still works as-is

Comment on lines +216 to +221
window.__ENV__ = {
VITE_ASGARDEO_CLIENT_ID: "your-real-asgardeo-client-id",
VITE_ASGARDEO_BASE_URL: "https://api.asgardeo.io/t/your-org",
VITE_RTI_TRACKER_SERVER_URL: "http://your-backend-service:8080",
VITE_FILE_STORAGE_BASE_URL: "https://your-storage-endpoint",
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Include the VITE_FILE_VIEW_BASE_URL variable in the example configuration to match the fields used in the application's runtime configuration.

Suggested change
window.__ENV__ = {
VITE_ASGARDEO_CLIENT_ID: "your-real-asgardeo-client-id",
VITE_ASGARDEO_BASE_URL: "https://api.asgardeo.io/t/your-org",
VITE_RTI_TRACKER_SERVER_URL: "http://your-backend-service:8080",
VITE_FILE_STORAGE_BASE_URL: "https://your-storage-endpoint",
};
window.__ENV__ = {
VITE_ASGARDEO_CLIENT_ID: "your-real-asgardeo-client-id",
VITE_ASGARDEO_BASE_URL: "https://api.asgardeo.io/t/your-org",
VITE_RTI_TRACKER_SERVER_URL: "http://your-backend-service:8080",
VITE_FILE_STORAGE_BASE_URL: "https://your-storage-endpoint",
VITE_FILE_VIEW_BASE_URL: "https://your-view-endpoint",
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this as well!


Once the `dist/` folder is produced, those values are frozen. No file mount, environment injection, or server restart will change what is already compiled into the JavaScript.

### Why WSO2's react buildpack Makes This Worse
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Why WSO2's react buildpack Makes This Worse
### How this differ from WSO2's react buildpack?

Comment on lines +135 to +153
const runtimeEnv = (window as any).__ENV__ ?? {};

export const config = {
ASGARDEO_CLIENT_ID:
runtimeEnv.VITE_ASGARDEO_CLIENT_ID ||
import.meta.env.VITE_ASGARDEO_CLIENT_ID,

ASGARDEO_BASE_URL:
runtimeEnv.VITE_ASGARDEO_BASE_URL ||
import.meta.env.VITE_ASGARDEO_BASE_URL,

RTI_TRACKER_SERVER_URL:
runtimeEnv.VITE_RTI_TRACKER_SERVER_URL ||
import.meta.env.VITE_RTI_TRACKER_SERVER_URL,

FILE_STORAGE_BASE_URL:
runtimeEnv.VITE_FILE_STORAGE_BASE_URL ||
import.meta.env.VITE_FILE_STORAGE_BASE_URL,
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add VITE_FILE_VIEW_BASE_URL as well

Comment on lines +216 to +221
window.__ENV__ = {
VITE_ASGARDEO_CLIENT_ID: "your-real-asgardeo-client-id",
VITE_ASGARDEO_BASE_URL: "https://api.asgardeo.io/t/your-org",
VITE_RTI_TRACKER_SERVER_URL: "http://your-backend-service:8080",
VITE_FILE_STORAGE_BASE_URL: "https://your-storage-endpoint",
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this as well!

@ChanukaUOJ
Copy link
Copy Markdown
Member

ChanukaUOJ commented May 13, 2026

Link the PR to an issue as well!

@ChanukaUOJ
Copy link
Copy Markdown
Member

@yasandu0505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants