Files
threshold-ui/ui/desktop/config/environment.js
T
hashiccandZhihe Li 63b810d53f Migrate from ember-cli-mirage to miragejs (#3088)
* chore: 🤖 import explicit mirage references

* chore: 🤖 add mirage setupMirage helper

* chore: 🤖 working example with application adapter test

* chore: 🤖 use internal setupMirage test helper from api addon

* chore: 🤖 conditionally load mirage

* chore: 🤖 filter mirage folder inclusion in production builds

* chore: 🤖 drop ember-mirage and use our own test helpers

* chore: 🤖 collapse reference to import declaration

* docs: ✏️ add comment better explaining the mirage test env

* chore: 🤖 update configuration and manage mirage-related deps

* fix: 🐛 restore ipc mock and add missing checkOS handler

* chore: 🤖 add comment explaining omitting mirage deps in build

* chore: 🤖 allow mirage.enabled to include deps and handlers

* chore: 🤖 re-enable mirage for core dummy app

* Add missing copyright headers

* chore: 🤖 use embroider macros to conditionally start mirage

* docs: ✏️ update api readme for mirage changes

* chore: 🤖 replace remaining ember-cli-mirage references

* chore: 🤖 add mirage to test builds

* fix: 🐛 ensure that auto mirage start doesn't happen in test env

* chore: 🤖 use const instead of var

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>

* refactor: 💡 use cleaner logic for excluded api build modules

* fix: 🐛 handle issue where importSync was too eager

This was fixed by bumping the @embroider/macros dependency that includes
a fix to this issue:
https://github.com/embroider-build/embroider/pull/2511

* refactor: 💡 move mirage from addon to app directory

* refactor: 💡 update mirage test helper to be a factory

* chore: 🤖 exclude mirage directory when necessary at build time

* chore: 🤖 add miragejs as admin dev dependency

* refactor: 💡 update reference to startMirage

* chore: 🤖 update local mirage test helper

* chore: 🤖 change import path for mirage on desktop

* chore: 🤖 update imports in tests for startMirage

* chore: 🤖 update startMirage imports for api addon tests

* chore: 🤖 add miragejs dev dep to desktop

* docs: ✏️ update README

* chore: 🤖 set up setupMirage for core tests

* chore: 🤖 fix copyright header

* Add missing copyright headers

---------

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
2026-02-03 13:54:32 -05:00

128 lines
3.3 KiB
JavaScript

/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
'use strict';
const APP_NAME = process.env.APP_NAME || 'Boundary';
const locationType = process.env.EMBER_CLI_ELECTRON ? 'hash' : 'history';
const ENABLE_A11Y_AUDIT = process.env.ENABLE_A11Y_AUDIT || false;
const COLOR_THEME = process.env.COLOR_THEME ?? 'light';
module.exports = function (environment) {
const ENV = {
modulePrefix: 'desktop',
environment,
rootURL: process.env.EMBER_CLI_ELECTRON ? '' : '/',
locationType,
EmberENV: {
EXTEND_PROTOTYPES: false,
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
isElectron: process.env.EMBER_CLI_ELECTRON
? JSON.parse(process.env.EMBER_CLI_ELECTRON)
: false,
api: {
// there is no default API host in desktop
//host: API_HOST,
namespace: 'v1',
},
appName: APP_NAME,
oidcPollingTimeoutSeconds: 1,
sessionPollingTimeoutSeconds: 2,
documentation: {
baseURL: 'https://developer.hashicorp.com/boundary',
topics: {
targets:
'/tutorials/oss-getting-started/oss-getting-started-desktop-app#connect',
sessions:
'/tutorials/oss-getting-started/oss-getting-started-desktop-app#connect',
'support-page': 'https://support.hashicorp.com/hc/en-us',
},
},
flashMessageDefaults: {
timeout: 4000,
},
featureFlags: {},
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
// This flag tells the origin route to autoset the controller origin field
// of the UI, which only makes sense in development where the origin is
// usually the same as the application origin.
ENV.autoOrigin = true;
ENV.mirage = {
enabled: process.env.ENABLE_MIRAGE
? JSON.parse(process.env.ENABLE_MIRAGE)
: true,
};
ENV.ENABLE_A11Y_AUDIT = ENABLE_A11Y_AUDIT;
ENV.COLOR_THEME = COLOR_THEME;
}
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
// Notification timeout should be 0 for fast tests
ENV.flashMessageDefaults.timeout = 0;
// OIDC Authentication timeout should be 0 for fast tests
ENV.oidcPollingTimeoutSeconds = 0;
// Sessions polling timeout should be 0 for fast tests
ENV.sessionPollingTimeoutSeconds = 0;
ENV.enableConfirmService = false;
// Use in-memory storage
ENV.storage = {
memory: true,
};
ENV.ENABLE_A11Y_AUDIT = ENABLE_A11Y_AUDIT;
ENV.COLOR_THEME = COLOR_THEME;
ENV.mirage = {
enabled: process.env.ENABLE_MIRAGE
? JSON.parse(process.env.ENABLE_MIRAGE)
: true,
};
}
if (environment === 'production') {
// here you can enable a production-specific feature
}
return ENV;
};