Skip to content

chore: add configuration for on-prem env [WPB-3615]#20524

Open
e-maad wants to merge 3 commits intodevfrom
chore/env-switch-onprem
Open

chore: add configuration for on-prem env [WPB-3615]#20524
e-maad wants to merge 3 commits intodevfrom
chore/env-switch-onprem

Conversation

@e-maad
Copy link
Contributor

@e-maad e-maad commented Feb 27, 2026

TopicWPB-3615 Onprem Installations

Pull Request

Summary

Added a script to dynamically switch environments without manually editing .env files.

Changes:

Createdstart-with-env.js - accepts environment parameter (dev, anta, bella, chala, fulu, imai, foma)
Updated yarn start to support yarn start [environment]
Moved all .env.* files to env/ folder for better organization

Security Checklist (required)

  • External inputs are validated & sanitized on client and/or server where applicable.
  • API responses are validated; unexpected shapes are handled safely (fallbacks or errors).
  • No unsafe HTML is rendered; if unavoidable, sanitization is applied and documented where it happens.
  • Injection risks (XSS/SQL/command) are prevented via safe APIs and/or escaping.

Accessibility (required)

Standards Acknowledgement (required)

Screenshots or demo (if the user interface changed)

Notes for reviewers

  • Trade-offs:
  • Follow-ups (linked issues):
  • Linked PRs (e.g. web-packages):

@sonarqubecloud
Copy link

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.44%. Comparing base (c740ab7) to head (45886d4).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #20524      +/-   ##
==========================================
- Coverage   45.44%   45.44%   -0.01%     
==========================================
  Files        1637     1637              
  Lines       40361    40361              
  Branches     8332     8332              
==========================================
- Hits        18342    18341       -1     
  Misses      20086    20086              
- Partials     1933     1934       +1     
Flag Coverage Δ
app_webapp 43.64% <ø> (-0.01%) ⬇️
lib_api_client 50.17% <ø> (ø)
lib_core 59.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

🔗 Download Full Report Artifact

🧪 Playwright Test Summary

  • Passed: 10
  • Failed: 0
  • Skipped: 4
  • 🔁 Flaky: 0
  • 📊 Total: 14
  • Total Runtime: 92.0s (~ 1 min 32 sec)

@e-maad e-maad changed the title Chore/env switch onprem chore: add configuration for on-prem env Feb 27, 2026
@e-maad e-maad changed the title chore: add configuration for on-prem env chore: add configuration for on-prem env [WPB-3615] Feb 27, 2026
Comment on lines +22 to +24
const fs = require('fs');
const path = require('path');
const {spawn} = require('child_process');
Copy link
Member

Choose a reason for hiding this comment

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

Avoid CommonJS (it's legacy/deprecated) at all costs and use ECMAScript modules

const {spawn} = require('child_process');

// Parse command line arguments
const args = process.argv.slice(2);
Copy link
Member

Choose a reason for hiding this comment

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

Should we introduce commander or yargs here?

const environment = args[0] || 'dev';

// Available environments
const availableEnvs = ['dev', 'anta', 'bella', 'chala', 'fulu', 'imai', 'foma'];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const availableEnvs = ['dev', 'anta', 'bella', 'chala', 'fulu', 'imai', 'foma'];
const availableEnvs = ['dev', 'anta', 'bella', 'chala', 'fulu', 'imai', 'foma'] as const;


// Parse command line arguments
const args = process.argv.slice(2);
const environment = args[0] || 'dev';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const environment = args[0] || 'dev';
const environment = args[0] ?? 'dev';


for (const line of lines) {
// Skip empty lines and comments
if (!line.trim() || line.trim().startsWith('#')) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!line.trim() || line.trim().startsWith('#')) {
const trimmedLine = line.trim();
if (trimmedLine === '' || trimmedLine.startsWith('#')) {

if (!availableEnvs.includes(environment)) {
console.error(`\n❌ Invalid environment: ${environment}`);
showUsage();
process.exit(1);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
process.exit(1);
process.exitCode = 1;

Avoid process.exit()

@@ -0,0 +1,207 @@
#!/usr/bin/env node
Copy link
Member

Choose a reason for hiding this comment

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

For the whole file we don't have any tests that verify the expected behavior

@@ -0,0 +1,45 @@
# Active environment: anta (merged with base .env)
Copy link
Member

Choose a reason for hiding this comment

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

.env.backup is not a backup right? It's more like a fallback or default as far as I can see?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants