Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace hardcoded config points #656

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down Expand Up @@ -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'
]
}
8 changes: 6 additions & 2 deletions src/components/Publish/_constants.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { allowFixedPricing, defaultAccessTerms } from '../../../app.config'
import {
allowFixedPricing,
customProviderUrl,
defaultAccessTerms
} from '../../../app.config'
import {
FormPublishData,
MetadataAlgorithmContainer,
Expand Down Expand Up @@ -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
},
Expand Down
10 changes: 4 additions & 6 deletions src/components/Publish/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
customProviderUrl,
defaultAccessTerms,
complianceApiVersion,
complianceUri
complianceUri,
allowedGaiaXRegistryDomains
} from '../../../app.config'
import { sanitizeUrl } from '@utils/url'
import { getContainerChecksum } from '@utils/docker'
Expand Down Expand Up @@ -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
Expand Down
Loading