Skip to content

Commit

Permalink
Change config handling for display test app (iTwin#6369)
Browse files Browse the repository at this point in the history
  • Loading branch information
hl662 authored Jan 16, 2024
1 parent e579c6d commit d0293c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions test-apps/display-test-app/src/common/DtaConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,16 @@ export const getConfig = (): DtaConfiguration => {

configuration.iModelId = process.env.IMJS_IMODEL_ID;
configuration.urlPrefix = process.env.IMJS_URL_PREFIX;
configuration.oidcClientId = process.env.IMJS_OIDC_CLIENT_ID;
configuration.oidcScope = process.env.IMJS_OIDC_SCOPE;
configuration.oidcRedirectUri = process.env.IMJS_OIDC_REDIRECT_URI;
if (ProcessDetector.isElectronAppFrontend) {
configuration.oidcClientId = process.env.IMJS_OIDC_ELECTRON_TEST_CLIENT_ID;
configuration.oidcScope = process.env.IMJS_OIDC_ELECTRON_TEST_SCOPES;
configuration.oidcRedirectUri = process.env.IMJS_OIDC_ELECTRON_TEST_REDIRECT_URI;
} else {
configuration.oidcClientId = process.env.IMJS_OIDC_CLIENT_ID;
configuration.oidcScope = process.env.IMJS_OIDC_SCOPE;
configuration.oidcRedirectUri = process.env.IMJS_OIDC_REDIRECT_URI;
}

configuration.ignoreCache = undefined !== process.env.IMJS_IGNORE_CACHE;

return configuration;
Expand Down
4 changes: 2 additions & 2 deletions test-apps/display-test-app/src/frontend/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ export class DisplayTestApp {
// ###TODO fix that in the client and remove this
if (!configuration.noElectronAuth)
opts.iModelApp!.authorizationClient = new ElectronRendererAuthorization({
clientId: getConfigurationString("oidcClientId") ?? "imodeljs-spa-test",
clientId: getConfigurationString("oidcClientId") ?? "native-testId",
});

await ElectronApp.startup(opts);
} else if (ProcessDetector.isMobileAppFrontend) {
await MobileApp.startup(opts as MobileAppOpts);
} else {
const redirectUri = "http://localhost:3000/signin-callback";
const redirectUri = getConfigurationString("oidcRedirectUri") ?? "http://localhost:3000/signin-callback";
const urlObj = new URL(redirectUri);
if (urlObj.pathname === window.location.pathname) {
const client = new BrowserAuthorizationClient({
Expand Down

0 comments on commit d0293c0

Please sign in to comment.