Skip to content

Commit

Permalink
Remove deprecated elements (#174)
Browse files Browse the repository at this point in the history
* chore: remove deprecated modules

* chore: remove backwards compatibility for creating attributes

* chore: remove ACCOUNT env key mapping

* chore: remove config rewrite from webhooksV2 to webhooks
  • Loading branch information
jkoenig134 authored Jun 6, 2024
1 parent 2ba5526 commit 4a1ec9a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 115 deletions.
13 changes: 0 additions & 13 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@
"targets": {},
"webhooks": []
},
"amqpPublisher": {
"enabled": false,
"displayName": "AMQP Publisher",
"location": "amqpPublisher/AMQPPublisherModule"
},
"PubSubPublisher": {
"enabled": false,
"displayName": "PubSub Publisher",
"location": "pubSubPublisher/PubSubPublisherModule",
"projectId": "",
"topic": "",
"keyFile": ""
},
"messageBrokerPublisher": {
"enabled": false,
"displayName": "Message Broker Publisher",
Expand Down
12 changes: 0 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { RuntimeConfig } from "@nmshd/runtime";
import _ from "lodash";
import nconf from "nconf";
import { ConnectorRuntime } from "./ConnectorRuntime";
import { ConnectorRuntimeConfig } from "./ConnectorRuntimeConfig";
Expand Down Expand Up @@ -30,21 +29,10 @@ export function createConnectorConfig(overrides?: RuntimeConfig): ConnectorRunti

const connectorConfig = nconf.get();

if (typeof connectorConfig.modules.webhooksV2 !== "undefined") {
// eslint-disable-next-line no-console
console.warn("The 'webhooksV2' configuration is deprecated. Please use 'webhooks' instead.");

connectorConfig.modules.webhooks = _.defaultsDeep(connectorConfig.modules.webhooksV2, connectorConfig.modules.webhooks);
delete connectorConfig.modules.webhooksV2;
}

return connectorConfig;
}

const envKeyMapping: Record<string, string> = {
// The DATABASE__DB_NAME env variable was called ACCOUNT in the past - we need to keep an alias for backwards compatibility.
ACCOUNT: "database:dbName", // eslint-disable-line @typescript-eslint/naming-convention

DATABASE_NAME: "database:dbName", // eslint-disable-line @typescript-eslint/naming-convention
API_KEY: "infrastructure:httpServer:apiKey", // eslint-disable-line @typescript-eslint/naming-convention
DATABASE_CONNECTION_STRING: "database:connectionString", // eslint-disable-line @typescript-eslint/naming-convention
Expand Down
38 changes: 0 additions & 38 deletions src/modules/amqpPublisher/AMQPPublisherModule.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/modules/coreHttpApi/controllers/AttributesController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ApplicationError } from "@js-soft/ts-utils";
import { ConsumptionServices, RuntimeErrors, TransportServices } from "@nmshd/runtime";
import { Inject } from "typescript-ioc";
import { Accept, Context, DELETE, GET, POST, Path, PathParam, QueryParam, Return, ServiceContext } from "typescript-rest";
Expand All @@ -17,19 +16,6 @@ export class AttributesController extends BaseController {
@POST
@Accept("application/json")
public async createRepositoryAttribute(request: any): Promise<Return.NewResource<Envelope>> {
const selfAddress = (await this.transportServices.account.getIdentityInfo()).value.address;
if (request?.content?.owner && request?.content?.owner !== selfAddress) {
throw new ApplicationError(
"error.connector.attributes.cannotCreateNotSelfOwnedRepositoryAttribute",
"You are not allowed to create an attribute that is not owned by yourself"
);
}
/* We left 'owner' and '@type' optional in the openapi spec for
* backwards compatibility. If set, they have to be removed here or the runtime
* use case will throw an error. */
if (typeof request?.content?.owner !== "undefined") delete request.content.owner;
if (request?.content?.["@type"] === "IdentityAttribute") delete request.content["@type"];

const result = await this.consumptionServices.attributes.createRepositoryAttribute(request);
return this.created(result);
}
Expand Down
38 changes: 0 additions & 38 deletions src/modules/pubSubPublisher/PubSubPublisherModule.ts

This file was deleted.

0 comments on commit 4a1ec9a

Please sign in to comment.