Skip to content

Commit

Permalink
122 additional connector self-description (#165)
Browse files Browse the repository at this point in the history
* fix contract policy created message

* feat EDC_UI_CONFIG_URL

* feat more connector self-description properties

* chore update CHANGELOG.md
  • Loading branch information
richardtreier authored Mar 6, 2023
1 parent 963208c commit 39dec8b
Show file tree
Hide file tree
Showing 52 changed files with 848 additions and 412 deletions.
18 changes: 15 additions & 3 deletions .env.local-dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# .env file configured for default npm run start commands
# see app-config-properties.ts for list of all configurable values
EDC_UI_ACTIVE_PROFILE=sovity-open-source

EDC_UI_DATA_MANAGEMENT_API_URL=http://localhost:3000/api/v1/data
EDC_UI_DATA_MANAGEMENT_API_KEY=no-api-key-required-in-local-dev
EDC_UI_CATALOG_URLS=http://existing-other-connector/v1/ids/data,http://does-not-exist-but-is-super-long-so-we-can-test/v1/ids/data, http://how-wrapping-works-in-subtext-of-catalog-url-select/v1/ids/data
EDC_UI_LOGOUT_URL=https://google.com
EDC_UI_ASSET_PROP_ORIGINATOR=http://localhost:3000/v1/ids/data
EDC_UI_ASSET_PROP_ORIGINATOR_ORGANIZATION=Example GmbH
EDC_UI_LOGOUT_URL=https://example.com/logout
EDC_UI_CONNECTOR_ENDPOINT=http://localhost:3000/v1/ids/data

EDC_UI_CONNECTOR_ID=https://example-connector-id/
EDC_UI_CONNECTOR_NAME=example-connector-name
EDC_UI_IDS_ID=urn:connector:example
EDC_UI_IDS_TITLE=Example Connector Title
EDC_UI_IDS_DESCRIPTION=This is an example EDC UI in local dev.
EDC_UI_CURATOR_URL=https://example.com
EDC_UI_CURATOR_ORGANIZATION_NAME=Example GmbH
EDC_UI_DAPS_OAUTH_TOKEN_URL=https://example-daps.com/token
EDC_UI_DAPS_OAUTH_JWKS_URL=https://example-daps.com/jwks.json
EDC_UI_MAINTAINER_URL=https://example.com
EDC_UI_MAINTAINER_ORGANIZATION_NAME=Example GmbH
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*.bash text eol=lf
*.fish text eol=lf
*.sh text eol=lf
*.env text eol=lf

# Windows Scripts need crlf
*.bat text eol=crlf
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ the detailed section referring to by linking pull requests or issues.

#### Added

- More Connector Self-Description properties in Dashboard.
- Info texts to differentiate Connector ID and Connector Endpoint.

#### Changed

#### Removed
Expand Down
39 changes: 21 additions & 18 deletions docs/getting-started/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,41 @@ version: '3.8'
services:
edc-ui:
image: ghcr.io/sovity/edc-ui:latest
container_name: edc-ui
ports:
- '11000:80'
environment:
- EDC_UI_ACTIVE_PROFILE=sovity-open-source
- EDC_UI_DATA_MANAGEMENT_API_URL=http://localhost:11002/api/v1/data
- EDC_UI_DATA_MANAGEMENT_API_KEY=ApiKeyDefaultValue
- EDC_UI_CATALOG_URLS=http://edc:11003/api/v1/ids/data
- EDC_UI_ASSET_PROP_ORIGINATOR=http://edc:11003/api/v1/ids/data
- EDC_UI_ASSET_PROP_ORIGINATOR_ORGANIZATION=Example GmbH
EDC_UI_ACTIVE_PROFILE: sovity-open-source
EDC_UI_DATA_MANAGEMENT_API_URL: http://localhost:11002/api/v1/data
EDC_UI_DATA_MANAGEMENT_API_KEY: ApiKeyDefaultValue
EDC_UI_CONFIG_URL: edc-ui-config

# Optionally add other preconfigured other connector endpoints for catalog browser
EDC_UI_CATALOG_URLS: http://edc:11003/api/v1/ids/data

edc:
container_name: edc
image: ghcr.io/sovity/edc:latest
environment:
# Basic Configuration
EDC_CONNECTOR_NAME: 'example-connector'
EDC_IDS_ID: urn:connector:example-connector
EDC_IDS_TITLE: 'Example GmbH EDC Connector'
EDC_IDS_DESCRIPTION: 'Minimal configured Open Source EDC built by sovity'
EDC_IDS_CURATOR: https://example-gmbh.com
EDC_UI_CURATOR_ORGANIZATION_NAME: Example GmbH
EDC_HOSTNAME: edc
IDS_WEBHOOK_ADDRESS: http://edc:11003
EDC_IDS_ENDPOINT: http://edc:11003/api/v1/ids
EDC_API_AUTH_KEY: ApiKeyDefaultValue

# Deployment Configuration
WEB_HTTP_PORT: 11001
WEB_HTTP_PATH: /api
WEB_HTTP_DATA_PORT: 11002
WEB_HTTP_DATA_PATH: /api/v1/data
WEB_HTTP_IDS_PORT: 11003
WEB_HTTP_IDS_PATH: /api/v1/ids
EDC_IDS_ID: urn:connector:example-connector
EDC_IDS_TITLE: 'Example GmbH EDC Connector'
EDC_IDS_DESCRIPTION:
'Minimally configured Open Source EDC built by sovity.'
EDC_IDS_ENDPOINT: http://edc:11003/api/v1/ids
IDS_WEBHOOK_ADDRESS: http://edc:11003
EDC_IDS_CURATOR: https://example.com
EDC_IDS_MAINTAINER: https://sovity.de
EDC_CONNECTOR_NAME: example-connector
EDC_HOSTNAME: edc
EDC_API_AUTH_KEY: ApiKeyDefaultValue
EDC_UI_MAINTAINER_ORGANIZATION_NAME: sovity GmbH
EDC_WEB_REST_CORS_ENABLED: 'true'
EDC_WEB_REST_CORS_HEADERS: 'origin,content-type,accept,authorization,x-api-key'
EDC_WEB_REST_CORS_ORIGINS: '*'
Expand Down
2 changes: 1 addition & 1 deletion src/modules/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {DashboardComponent} from '../edc-demo/components/dashboard/dashboard.com
import {LogoutComponent} from '../edc-demo/components/logout/logout.component';
import {PolicyViewComponent} from '../edc-demo/components/policy-view/policy-view.component';
import {TransferHistoryViewerComponent} from '../edc-demo/components/transfer-history/transfer-history-viewer.component';
import {EdcUiFeature} from './config/edc-ui-feature';
import {EdcUiFeature} from './config/profiles/edc-ui-feature';

export const routes: Routes = [
{
Expand Down
2 changes: 2 additions & 0 deletions src/modules/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {loadAppConfigOnStartup} from './config/app-config-initializer';
import {provideConfigProperty} from './config/app-config-injection-utils';
import {AppConfigBuilder} from './config/app-config.builder';
import {AppConfigFetcher} from './config/app-config.fetcher';
import {AppConfigMerger} from './config/app-config.merger';
import {AppConfigService} from './config/app-config.service';

@NgModule({
Expand Down Expand Up @@ -56,6 +57,7 @@ import {AppConfigService} from './config/app-config.service';
],
declarations: [AppComponent, NavigationComponent],
providers: [
AppConfigMerger,
AppConfigFetcher,
AppConfigBuilder,
AppConfigService,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/app/config/active-feature-set.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core';
import {AppConfigService} from './app-config.service';
import {EdcUiFeature} from './edc-ui-feature';
import {EdcUiFeature} from './profiles/edc-ui-feature';

@Injectable({providedIn: 'root'})
export class ActiveFeatureSet {
Expand Down
3 changes: 1 addition & 2 deletions src/modules/app/config/app-config-initializer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {APP_INITIALIZER, Provider} from '@angular/core';
import {environment} from '../../../environments/environment';
import {AppConfig} from './app-config';
import {AppConfigBuilder} from './app-config.builder';
import {AppConfigFetcher} from './app-config.fetcher';
Expand All @@ -20,7 +19,7 @@ export const loadAppConfigOnStartup = (): Provider => ({
) =>
() =>
fetcher
.fetchConfigJson()
.fetchEffectiveConfig('/assets/config/app-config.json', null)
.then((json) => builder.buildAppConfig(json))
.then((config: AppConfig) => service.setConfig(config)),
});
96 changes: 87 additions & 9 deletions src/modules/app/config/app-config-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@ export const AppConfigProperties = {
*
* Individual ENV Vars will take precedence over this JSON.
*/
configJson: `EDC_UI_CONFIG_JSON`,
configJson: 'EDC_UI_CONFIG_JSON',

/**
* Additional URL to fetch a Config JSON from that will take precedence.
*
* This allows an EDC Backend Extension to provide EDC UI configuration
*
* If this URL is relative, it will be appended to the {@link AppConfigProperties.dataManagementApiUrl}.
*
* The JSON should be a {@link Record<string, string>}
*/
configUrl: 'EDC_UI_CONFIG_URL',

/**
* Customer-Specific Feature Set and/or Theme.
*
* See {@link EDC_UI_PROFILE_DATA} in `edc-ui-profile.ts` for all available profiles.
* See {@link EDC_UI_PROFILE_DATA} for all available profiles.
*/
activeProfile: 'EDC_UI_ACTIVE_PROFILE',

Expand All @@ -29,25 +40,92 @@ export const AppConfigProperties = {
*/
dataManagementApiKey: 'EDC_UI_DATA_MANAGEMENT_API_KEY',

/**
* Logout URL.
*/
logoutUrl: 'EDC_UI_LOGOUT_URL',

/**
* Current Connector Endpoint.
* When creating assets, this is added as asset property.
*/
connectorEndpoint: 'EDC_UI_CONNECTOR_ENDPOINT',

/**
* Pre-configured Other Connector Endpoints to be used in catalog browser, comma separated.
*/
catalogUrls: 'EDC_UI_CATALOG_URLS',

/**
* Logout URL.
* Connector ID, usually https://hostname of EDC backend.
*
* E.g. contained in DAT Claim "referringConnector".
* And will be used to realize the connector restricted policy.
*/
logoutUrl: 'EDC_UI_LOGOUT_URL',
connectorId: 'EDC_UI_CONNECTOR_ID',

/**
* Originator Connector URL.
* When creating assets, this is added as asset property.
* Connector Name, e.g. used by broker extension
*/
originator: 'EDC_UI_ASSET_PROP_ORIGINATOR',
connectorName: 'EDC_UI_CONNECTOR_NAME',

/**
* Organization Name.
* Connector IDS ID, e.g. urn:connector:sth
*/
connectorIdsId: 'EDC_UI_IDS_ID',

/**
* Connector Title, e.g. "Sovity Test Connector 001"
*/
connectorIdsTitle: 'EDC_UI_IDS_TITLE',

/**
* Connector Description Text
*/
connectorIdsDescription: 'EDC_UI_IDS_DESCRIPTION',

/**
* DAPS OAUTH Token URL
*/
dapsOauthTokenUrl: 'EDC_UI_DAPS_OAUTH_TOKEN_URL',

/**
* DAPS OAUTH JWKS URL
*/
dapsOauthJwksUrl: 'EDC_UI_DAPS_OAUTH_JWKS_URL',

/**
* Curator Organization Homepage
*/
curatorUrl: 'EDC_UI_CURATOR_URL',

/**
* Curator Organization Name.
* When creating assets, this is added as asset property.
*/
originatorOrganization: 'EDC_UI_ASSET_PROP_ORIGINATOR_ORGANIZATION',
curatorOrganizationName: 'EDC_UI_CURATOR_ORGANIZATION_NAME',

/**
* Maintainer Organization Homepage
*/
maintainerUrl: 'EDC_UI_MAINTAINER_URL',

/**
* Maintainer Organization Name.
*/
maintainerOrganizationName: 'EDC_UI_MAINTAINER_ORGANIZATION_NAME',

/**
* Same as {@link connectorEndpoint}.
*
* @deprecated Use {@link connectorEndpoint} instead.
*/
_legacyConnectorEndpoint: 'EDC_UI_ASSET_PROP_ORIGINATOR',

/**
* Same as {@link curatorOrganizationName}.
*
* @deprecated Use {@link curatorOrganizationName} instead.
*/
_legacyCuratorOrganizationName: 'EDC_UI_ASSET_PROP_ORIGINATOR_ORGANIZATION',
};
67 changes: 51 additions & 16 deletions src/modules/app/config/app-config.builder.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,79 @@
import {Injectable} from '@angular/core';
import {AppConfig} from './app-config';
import {AppConfigProperties} from './app-config-properties';
import {EDC_UI_PROFILE_DATA, getProfileOrFallback} from './edc-ui-profile';
import {getProfileOrFallback} from './profiles/get-profile-or-fallback';

@Injectable()
export class AppConfigBuilder {
/**
* Build {@link AppConfig} from ENV Vars
*
* @param envVars env vars
* @param vars env vars
*/
buildAppConfig(envVars: Record<string, string | null>): AppConfig {
const vars = {
...JSON.parse(envVars[AppConfigProperties.configJson] || '{}'),
...envVars,
};
buildAppConfig(vars: Record<string, string | null>): AppConfig {

const profile = getProfileOrFallback(
const {profile, profileConfig} = getProfileOrFallback(
vars[AppConfigProperties.activeProfile],
);

return {
// profile and theme
profile,
...EDC_UI_PROFILE_DATA[profile],
...profileConfig,

// EDC Backend Endpoints
connectorEndpoint:
vars[AppConfigProperties.connectorEndpoint] ??
vars[AppConfigProperties._legacyConnectorEndpoint] ??
'https://no-connector-endpoint-configured',
dataManagementApiKey:
vars[AppConfigProperties.dataManagementApiKey] ??
'no-api-key-configured',
dataManagementApiUrl:
vars[AppConfigProperties.dataManagementApiUrl] ??
'https://no-backend-api-url-configured',
originator:
vars[AppConfigProperties.originator] ??
'https://no-originator-configured',
originatorOrganization:
vars[AppConfigProperties.originatorOrganization] ??
'No Originator Organization Configured',
catalogUrl: vars[AppConfigProperties.catalogUrls] ?? '',
logoutUrl:
vars[AppConfigProperties.logoutUrl] ??
'https://no-logout-url-configured',

// Other EDC Backend Endpoints
catalogUrls: vars[AppConfigProperties.catalogUrls] ?? '',

// Connector Self-Description
connectorId:
vars[AppConfigProperties.connectorId] ??
'https://missing-edc-connector-id',
connectorName:
vars[AppConfigProperties.connectorName] ??
'EDC Connector (No Name Configured)',
connectorIdsId:
vars[AppConfigProperties.connectorIdsId] ??
'no-ids-connector-id-configured',
connectorIdsTitle:
vars[AppConfigProperties.connectorIdsTitle] ??
'EDC Connector (No Title Configured)',
connectorIdsDescription:
vars[AppConfigProperties.connectorIdsDescription] ??
'No Connector Description was configured.',
curatorUrl:
vars[AppConfigProperties.curatorUrl] ??
'http://no-curator-url-configured',
curatorOrganizationName:
vars[AppConfigProperties.curatorOrganizationName] ??
vars[AppConfigProperties._legacyCuratorOrganizationName] ??
'No Curator Organization Name Configured',
dapsOauthTokenUrl:
vars[AppConfigProperties.dapsOauthTokenUrl] ??
'http://no-daps-oauth-token-url-configured',
dapsOauthJwksUrl:
vars[AppConfigProperties.dapsOauthJwksUrl] ??
'http://no-daps-oauth-jwks-url-configured',
maintainerUrl:
vars[AppConfigProperties.maintainerUrl] ??
'http://no-maintainer-url-configured',
maintainerOrganizationName:
vars[AppConfigProperties.maintainerOrganizationName] ??
'No Maintainer Organization Name Configured',
};
}
}
Loading

0 comments on commit 39dec8b

Please sign in to comment.