From 1a1fae07037c1e820f5de820c543ff29dec3e7cf Mon Sep 17 00:00:00 2001 From: KevinRohlf <123676073+KevinRohlf@users.noreply.github.com> Date: Thu, 30 Jan 2025 12:13:35 +0100 Subject: [PATCH] refactor: update provider URL configuration and add allowed Gaia-X registry domains --- app.config.js | 10 ++++++++-- src/components/Publish/_constants.tsx | 8 ++++++-- src/components/Publish/_utils.ts | 10 ++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app.config.js b/app.config.js index 14f1f727..089fa399 100644 --- a/app.config.js +++ b/app.config.js @@ -27,7 +27,8 @@ module.exports = { // List of all supported chainIds. Used to populate the Chains user preferences list. chainIdsSupported: getSupportedChainIds(), - customProviderUrl: process.env.NEXT_PUBLIC_PROVIDER_URL, + customProviderUrl: + process.env.NEXT_PUBLIC_PROVIDER_URL || 'https://provider.test.pontus-x.eu', infuraProjectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID || 'xxx', @@ -117,5 +118,10 @@ module.exports = { }, showOnboardingModuleByDefault: - process.env.NEXT_PUBLIC_SHOW_ONBOARDING_MODULE_BY_DEFAULT === 'true' + process.env.NEXT_PUBLIC_SHOW_ONBOARDING_MODULE_BY_DEFAULT === 'true', + + allowedGaiaXRegistryDomains: [ + 'https://registry.gaia-x.eu/v2206', + 'https://registry.lab.gaia-x.eu/v2206' + ] } diff --git a/src/components/Publish/_constants.tsx b/src/components/Publish/_constants.tsx index 078e8afe..825dec0d 100644 --- a/src/components/Publish/_constants.tsx +++ b/src/components/Publish/_constants.tsx @@ -1,4 +1,8 @@ -import { allowFixedPricing, defaultAccessTerms } from '../../../app.config' +import { + allowFixedPricing, + customProviderUrl, + defaultAccessTerms +} from '../../../app.config' import { FormPublishData, MetadataAlgorithmContainer, @@ -99,7 +103,7 @@ export const initialValues: FormPublishData = { dataTokenOptions: { name: '', symbol: '' }, access: 'access', providerUrl: { - url: 'https://provider.test.pontus-x.eu', + url: customProviderUrl, valid: true, custom: false }, diff --git a/src/components/Publish/_utils.ts b/src/components/Publish/_utils.ts index bf3bcb77..341d152f 100644 --- a/src/components/Publish/_utils.ts +++ b/src/components/Publish/_utils.ts @@ -34,7 +34,8 @@ import { customProviderUrl, defaultAccessTerms, complianceApiVersion, - complianceUri + complianceUri, + allowedGaiaXRegistryDomains } from '../../../app.config' import { sanitizeUrl } from '@utils/url' import { getContainerChecksum } from '@utils/docker' @@ -412,15 +413,12 @@ export async function createTokensAndPricing( export function getComplianceApiVersion(context?: string[]): string { const latest = complianceApiVersion - const allowedRegistryDomains = [ - 'https://registry.gaia-x.eu/v2206', - 'https://registry.lab.gaia-x.eu/v2206' - ] if ( !context || !context.length || context.some( - (e) => allowedRegistryDomains.findIndex((x) => e.startsWith(x)) !== -1 + (e) => + allowedGaiaXRegistryDomains.findIndex((x) => e.startsWith(x)) !== -1 ) ) return latest