diff --git a/.env.development.local.template b/.env.development.local.template index c1ba5363..3a4b7100 100644 --- a/.env.development.local.template +++ b/.env.development.local.template @@ -17,6 +17,7 @@ NODE_TLS_REJECT_UNAUTHORIZED=0 [gateway] RUCIO_AUTH_HOST=https://rucio-devmaany.cern.ch:443 RUCIO_HOST=https://rucio-devmaany.cern.ch:443 +RULE_ACTIVITY=User Subscriptions PARAMS_ENCODING_ENABLED=false [oidc] diff --git a/src/lib/core/port/secondary/env-config-gateway-output-port.ts b/src/lib/core/port/secondary/env-config-gateway-output-port.ts index 9974fc92..bb844f8d 100644 --- a/src/lib/core/port/secondary/env-config-gateway-output-port.ts +++ b/src/lib/core/port/secondary/env-config-gateway-output-port.ts @@ -61,6 +61,11 @@ export default interface EnvConfigGatewayOutputPort { */ projectURL(): Promise; + /** + * @returns the rule activity string + */ + ruleActivity(): Promise; + /** * @returns whether the query parameters should get URI encoded */ diff --git a/src/lib/infrastructure/gateway/env-config-gateway.ts b/src/lib/infrastructure/gateway/env-config-gateway.ts index d3f6c063..1c897c8c 100644 --- a/src/lib/infrastructure/gateway/env-config-gateway.ts +++ b/src/lib/infrastructure/gateway/env-config-gateway.ts @@ -154,6 +154,12 @@ class EnvConfigGateway implements EnvConfigGatewayOutputPort { return Promise.resolve(true); } + async ruleActivity(): Promise { + const value = await this.get('RULE_ACTIVITY'); + // Return a default value if the environmental variable is not specified + return value ?? 'User Subscriptions'; + } + async get(key: string, required: boolean = false): Promise { let value = process.env[key]; if (value !== undefined) { diff --git a/src/lib/infrastructure/gateway/rule-gateway/endpoints/create-rule-endpoint.ts b/src/lib/infrastructure/gateway/rule-gateway/endpoints/create-rule-endpoint.ts index 19e247fc..00808210 100644 --- a/src/lib/infrastructure/gateway/rule-gateway/endpoints/create-rule-endpoint.ts +++ b/src/lib/infrastructure/gateway/rule-gateway/endpoints/create-rule-endpoint.ts @@ -14,7 +14,7 @@ export default class CreateRuleEndpoint extends BaseEndpoint { const rucioHost = await this.envConfigGateway.rucioHost(); const endpoint = `${rucioHost}/rules/`; - this.params.activity = 'User Subscriptions'; + this.params.activity = await this.envConfigGateway.ruleActivity(); const request: HTTPRequest = { method: 'POST',