Skip to content

Commit

Permalink
Merge pull request #577 from kubeshop/f1ames/chore/schemas-origin
Browse files Browse the repository at this point in the history
chore: add 'schemasOrigin' as predefined 'OriginConfig' key
  • Loading branch information
f1ames authored Nov 24, 2023
2 parents 79964c4 + 4b6b812 commit 338da72
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-adults-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@monokle/synchronizer": patch
---

Added 'schemasOrigin' as predefined 'OriginConfig' key
3 changes: 3 additions & 0 deletions packages/synchronizer/src/__tests__/apiHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe('ApiHandler Tests', () => {
origin: 'https://test.monokle.com',
apiOrigin: 'https://api.test.monokle.com',
authOrigin: 'https://auth.test.monokle.com',
schemasOrigin: 'https://schemas.test.monokle.com',
});
assert.equal('https://api.test.monokle.com', apiHandler.apiUrl);
});
Expand All @@ -79,6 +80,7 @@ describe('ApiHandler Tests', () => {
origin: 'https://custom.domain.io',
apiOrigin: 'https://custom.domain.io/api',
authOrigin: 'https://custom.domain.io/auth',
schemasOrigin: 'https://custom.domain.io/schemas',
});

assert.equal('https://custom.domain.io/api', apiHandler.apiUrl);
Expand All @@ -99,6 +101,7 @@ describe('ApiHandler Tests', () => {
origin: 'https://custom.domain.io',
apiOrigin: 'https://custom.domain.io/api',
authOrigin: 'https://custom.domain.io/auth',
schemasOrigin: 'https://custom.domain.io/schemas',
});
assert.equal('https://custom.domain.io/projects', apiHandler.generateDeepLink('projects'));
});
Expand Down
3 changes: 3 additions & 0 deletions packages/synchronizer/src/__tests__/fetcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ describe('Fetcher Tests', () => {
OIDC_DISCOVERY_URL: "https://id.monokle.local/realms/monokle",
CLIENT_ID: "clientId",
SCHEMA_BASE_URL: "https://plugins.monokle.local/schemas",
};
`);
});
Expand All @@ -146,6 +148,7 @@ describe('Fetcher Tests', () => {
assert.equal(originData?.origin, 'http://localhost:13000');
assert.equal(originData?.apiOrigin, 'https://api.monokle.local');
assert.equal(originData?.authOrigin, 'https://id.monokle.local/realms/monokle');
assert.equal(originData?.schemasOrigin, 'https://plugins.monokle.local/schemas');

res();
} catch (err) {
Expand Down
2 changes: 2 additions & 0 deletions packages/synchronizer/src/handlers/configHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type OriginConfig = {
origin: string;
apiOrigin: string;
authOrigin: string;
schemasOrigin: string;
[key: string]: string;
};

Expand Down Expand Up @@ -43,6 +44,7 @@ export async function fetchOriginConfig(origin: string) {
values.origin = normalizeUrl(origin);
values.apiOrigin = values.API_ORIGIN;
values.authOrigin = values.OIDC_DISCOVERY_URL;
values.schemasOrigin = values.SCHEMA_BASE_URL;
}

originConfigCache = {
Expand Down

0 comments on commit 338da72

Please sign in to comment.