Skip to content

Commit

Permalink
feat: simplified endpoint env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
eschrewe committed Mar 15, 2024
1 parent 40965ea commit 3320d3b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ public class VariablesService {
* The port used by this apps server application.
*/
private String serverPort;
@Value("${puris.baseurl}")
private String purisBaseUrl;
@Value("${puris.demonstrator.role}")
/**
* Must be set to "CUSTOMER" or "SUPPLIER" if
* you want to start with some initial settings
* defined in the DataInjectionCommandLineRunner
*/
private String demoRole;
@Value("${puris.edr.endpoint}")

@Value("${puris.baseurl}" + "catena/edrendpoint")
/**
* The edrEndpoint to be used during consumer pull asset transfers.
*/
Expand All @@ -57,7 +60,7 @@ public class VariablesService {
* in the context of a consumer pull is removed from memory
*/
private long edrTokenDeletionTimer;
@Value("${puris.request.serverendpoint}")
@Value("${puris.baseurl}" + "catena/item-stock/request")
/**
* The url under which this application's request endpoint can
* be reached by external machines.
Expand All @@ -69,7 +72,7 @@ public class VariablesService {
* during asset creation.
*/
private String requestApiAssetId;
@Value("${puris.response.serverendpoint}")
@Value("${puris.baseurl}" + "catena/item-stock/response")
/**
* The url under which this application's response endpoint can
* be reached by external machines.
Expand All @@ -87,7 +90,7 @@ public class VariablesService {
* during asset creation.
*/
private String statusRequestApiAssetId;
@Value("${puris.statusrequest.serverendpoint}")
@Value("${puris.baseurl}" + "catena/item-stock/status")
/**
* The url under which this application's status-request endpoint
* can be reached by external machines.
Expand Down Expand Up @@ -116,7 +119,7 @@ public class VariablesService {
*/
private String dtrUrl;

@Value("${puris.parttypeinformation.serverendpoint}")
@Value("${puris.baseurl}" + "catena/parttype")
private String parttypeInformationServerendpoint;

@Value("${puris.generatematerialcatenaxid}")
Expand Down
9 changes: 4 additions & 5 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Server Config
server.port=${SERVER_PORT:8081}

# Requires a trailing "/"
puris.baseurl=${PURIS_BASEURL:http://customer-backend:8081/}

puris.demonstrator.role=${PURIS_DEMONSTRATOR_ROLE:customer}
puris.edr.endpoint=${PURIS_EDR_ENDPOINT:http://customer-backend:8081/catena/edrendpoint}
puris.edr.deletiontimer=${PURIS_EDR_DELETIONTIMER:2}
puris.request.serverendpoint=${PURIS_REQUEST_SERVERENDPOINT:http://customer-backend:8081/catena/product-stock/request}
puris.request.apiassetid=${PURIS_REQUEST_APIASSETID:request-api-asset}
puris.response.serverendpoint=${PURIS_RESPONSE_SERVERENDPOINT:http://customer-backend:8081/catena/product-stock/response}
puris.response.apiassetid=${PURIS_RESPONSE_APIASSETID:response-api-asset}
puris.statusrequest.apiassetid=${PURIS_STATUSREQUEST_APIASSETID:statusrequest-api-asset}
puris.statusrequest.serverendpoint=${PURIS_STATUSREQUEST_SERVERENDPOINT:http://customer-backend:8081/catena/item-stock/status}
puris.frameworkagreement.use=${PURIS_FRAMEWORKAGREEMENT_USE:false}
puris.frameworkagreement.credential=${PURIS_FRAMEWORKAGREEMENT_CREDENTIAL:FrameworkAgreement.traceability}
puris.api.key=${PURIS_API_KEY:test}
puris.dtr.url=${PURIS_DTR_URL:http://localhost:4243}
puris.parttypeinformation.serverendpoint=${PURIS_PARTTYPEINFORMATION_SERVERENDPOINT:http://customer-backend:8081/catena/parttype}

# Flag that decides whether the auto-generation feature of the puris backend is enabled.
# Since all Material entities are required to have a CatenaX-Id, you must enter any pre-existing CatenaX-Id
Expand Down
6 changes: 1 addition & 5 deletions backend/src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# Server Config
server.port=${SERVER_PORT:8081}
puris.demonstrator.role=${PURIS_DEMONSTRATOR_ROLE:customer}
puris.edr.endpoint=${PURIS_EDR_ENDPOINT:http://customer-backend:8081/catena/edrendpoint}
puris.baseurl=${PURIS_BASEURL:http://customer-backend:8081/}
puris.edr.deletiontimer=${PURIS_EDR_DELETIONTIMER:2}
puris.request.serverendpoint=${PURIS_REQUEST_SERVERENDPOINT:http://customer-backend:8081/catena/item-stock/request}
puris.request.apiassetid=${PURIS_REQUEST_APIASSETID:request-api-asset}
puris.response.serverendpoint=${PURIS_RESPONSE_SERVERENDPOINT:http://customer-backend:8081/catena/item-stock/response}
puris.response.apiassetid=${PURIS_RESPONSE_APIASSETID:response-api-asset}
puris.statusrequest.apiassetid=${PURIS_STATUSREQUEST_APIASSETID:statusrequest-api-asset}
puris.statusrequest.serverendpoint=${PURIS_STATUSREQUEST_SERVERENDPOINT:http://customer-backend:8081/catena/item-stock/status}
puris.frameworkagreement.use=${PURIS_FRAMEWORKAGREEMENT_USE:false}
puris.frameworkagreement.credential=${PURIS_FRAMEWORKAGREEMENT_CREDENTIAL:FrameworkAgreement.traceability}
puris.api.key=${PURIS_API_KEY:test}
puris.dtr.url=${PURIS_DTR_URL:http://localhost:4243}
puris.parttypeinformation.serverendpoint=${PURIS_PARTTYPEINFORMATION_SERVERENDPOINT:http://customer-backend:8081/catena/parttype}
puris.generatematerialcatenaxid=${PURIS_GENERATEMATERIALCATENAXID:true}

# DB Configuration
Expand Down
5 changes: 1 addition & 4 deletions charts/puris/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ $ helm install puris --namespace puris --create-namespace .
| backend.podSecurityContext | object | `{}` | Added security contexts for a pod |
| backend.puris.api.key | string | `"test"` | The API key of the PURIS application |
| backend.puris.api.rootDir | string | `"/catena"` | The root directory of the API |
| backend.puris.baseurl | string | `"customer-backend:8081/"` | Base url of the PURIS backend (requires a trailing "/") |
| backend.puris.datasource.driverClassName | string | `"org.postgresql.Driver"` | Driver class name of the database |
| backend.puris.datasource.password | string | `nil` | Password for the database user. Ignored if postgres.enabled is true. |
| backend.puris.datasource.url | string | `"jdbc:postgresql://postgresql-name:5432/puris-database"` | URL of the database. Ignored if postgres.enabled is true. |
Expand All @@ -71,7 +72,6 @@ $ helm install puris --namespace puris --create-namespace .
| backend.puris.edc.controlplane.protocol.url | string | `"https://your-edc-address:8184/api/v1/dsp"` | Url to the EDC controlplane protocol API of the edc |
| backend.puris.edc.dataplane.public.url | string | `"https://your-data-plane:8285/api/public/"` | Url of one of your data plane's public api |
| backend.puris.edr.deletiontimer | int | `2` | Number of minutes before received authentication data of a consumer pull is removed from memory |
| backend.puris.edr.endpoint | string | `"your-backend-host-address.com"` | Endpoint for EDR |
| backend.puris.existingSecret | string | `"secret-backend-puris"` | Secret for backend passwords. For more information look into 'backend-secrets.yaml' file. |
| backend.puris.frameworkagreement.credential | string | `"FrameworkAgreement.traceability"` | The name of the framework agreement |
| backend.puris.frameworkagreement.use | bool | `false` | Flag to determine whether to use a framework agreement in puris |
Expand All @@ -87,11 +87,8 @@ $ helm install puris --namespace puris --create-namespace .
| backend.puris.own.streetnumber | string | `"Musterstraße 110A"` | Own street and number |
| backend.puris.own.zipcodeandcity | string | `"12345 Musterhausen"` | Own zipcode and city |
| backend.puris.request.apiassetid | string | `"request-api-asset"` | Asset ID for request API |
| backend.puris.request.serverendpoint | string | `"your-backend-host-address.com"` | Endpoint of server for request |
| backend.puris.response.apiassetid | string | `"response-api-asset"` | Asset ID for response API |
| backend.puris.response.serverendpoint | string | `"your-backend-host-address.com"` | Endpoint of server for response |
| backend.puris.statusrequest.apiassetid | string | `"statusrequest-api-asset"` | Asset ID for status-request API |
| backend.puris.statusrequest.serverendpoint | string | `"your-backend-host-address.com"` | Endpoint of server for statusrequest |
| backend.readinessProbe | object | `{"failureThreshold":3,"initialDelaySeconds":120,"periodSeconds":25,"successThreshold":1,"timeoutSeconds":1}` | Checks if the pod is fully ready to operate |
| backend.readinessProbe.failureThreshold | int | `3` | Number of failures (threshold) for a readiness probe |
| backend.readinessProbe.initialDelaySeconds | int | `120` | Delay in seconds after which an initial readiness probe is checked |
Expand Down
28 changes: 5 additions & 23 deletions charts/puris/templates/backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,18 @@ spec:
key: "puris-api-key"
- name: PURIS_DEMONSTRATOR_ROLE
value: "{{ .Values.backend.puris.demonstrator.role }}"
- name: PURIS_EDR_DELETIONTIMER
value: "{{ .Values.backend.puris.edr.deletiontimer }}"
- name: PURIS_EDR_ENDPOINT
{{- if and .Values.backend.ingress.enabled .Values.backend.ingress.tls }}
value: "https://{{ .Values.backend.puris.edr.endpoint }}{{ .Values.backend.puris.api.rootDir }}/edrendpoint"
{{- else }}
value: "http://{{ .Values.backend.puris.edr.endpoint }}{{ .Values.backend.puris.api.rootDir }}/edrendpoint"
{{- end }}
- name: PURIS_REQUEST_SERVERENDPOINT
- name: PURIS_BASEURL
{{- if and .Values.backend.ingress.enabled .Values.backend.ingress.tls }}
value: "https://{{ .Values.backend.puris.request.serverendpoint }}{{ .Values.backend.puris.api.rootDir }}/item-stock/request"
value: "https://{{ .Values.backend.puris.baseurl }}"
{{- else }}
value: "http://{{ .Values.backend.puris.request.serverendpoint }}{{ .Values.backend.puris.api.rootDir }}/item-stock/request"
value: "http://{{ .Values.backend.puris.baseurl }}"
{{- end}}
- name: PURIS_EDR_DELETIONTIMER
value: "{{ .Values.backend.puris.edr.deletiontimer }}"
- name: PURIS_REQUEST_APIASSETID
value: "{{ .Values.backend.puris.request.apiassetid }}"
- name: PURIS_RESPONSE_SERVERENDPOINT
{{- if and .Values.backend.ingress.enabled .Values.backend.ingress.tls }}
value: "https://{{ .Values.backend.puris.response.serverendpoint }}{{ .Values.backend.puris.api.rootDir }}/item-stock/response"
{{- else }}
value: "http://{{ .Values.backend.puris.response.serverendpoint }}{{ .Values.backend.puris.api.rootDir }}/item-stock/response"
{{- end}}
- name: PURIS_RESPONSE_APIASSETID
value: "{{ .Values.backend.puris.response.apiassetid }}"
- name: PURIS_STATUSREQUEST_SERVERENDPOINT
{{- if and .Values.backend.ingress.enabled .Values.backend.ingress.tls }}
value: "https://{{ .Values.backend.puris.statusrequest.serverendpoint }}{{ .Values.backend.puris.api.rootDir }}/item-stock/status"
{{- else }}
value: "http://{{ .Values.backend.puris.statusrequest.serverendpoint }}{{ .Values.backend.puris.api.rootDir }}/item-stock/status"
{{- end}}
- name: PURIS_STATUSREQUEST_APIASSETID
value: "{{ .Values.backend.puris.statusrequest.apiassetid }}"
- name: PURIS_FRAMEWORKAGREEMENT_USE
Expand Down
10 changes: 2 additions & 8 deletions charts/puris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ backend:
timeoutSeconds: 1

puris:
# -- Base url of the PURIS backend (requires a trailing "/")
baseurl: customer-backend:8081/
# -- Secret for backend passwords. For more information look into 'backend-secrets.yaml' file.
existingSecret: "secret-backend-puris"
api:
Expand Down Expand Up @@ -410,18 +412,12 @@ backend:
# -- Enables "Lazy load no trans" property to fetch of each lazy entity to open a temporary session and run inside a separate transaction
enable_lazy_load_no_trans: true
request:
# -- Endpoint of server for request
serverendpoint: *domain
# -- Asset ID for request API
apiassetid: request-api-asset
response:
# -- Endpoint of server for response
serverendpoint: *domain
# -- Asset ID for response API
apiassetid: response-api-asset
statusrequest:
# -- Endpoint of server for statusrequest
serverendpoint: *domain
# -- Asset ID for status-request API
apiassetid: statusrequest-api-asset
frameworkagreement:
Expand All @@ -432,8 +428,6 @@ backend:
edr:
# -- Number of minutes before received authentication data of a consumer pull is removed from memory
deletiontimer: 2
# -- Endpoint for EDR
endpoint: *domain
dtr:
# --Endpoint for DTR
url: http://localhost:4243
Expand Down
6 changes: 1 addition & 5 deletions local/tractus-x-edc/config/customer/puris-backend.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
server.port=8081
puris.demonstrator.role=customer
puris.edr.endpoint=http://customer-backend:8081/catena/edrendpoint
puris.baseurl=http://customer-backend:8081/
puris.edr.deletiontimer=2
puris.request.serverendpoint=http://customer-backend:8081/catena/item-stock/request
puris.request.apiassetid=request-api-asset
puris.statusrequest.serverendpoint=http://customer-backend:8081/catena/item-stock/status
puris.statusrequest.apiassetid=statusrequest-api-asset
puris.response.serverendpoint=http://customer-backend:8081/catena/item-stock/response
puris.response.apiassetid=response-api-asset
puris.frameworkagreement.use=true
puris.frameworkagreement.credential=FrameworkAgreement.traceability
puris.api.key=${CUSTOMER_BACKEND_API_KEY}
puris.dtr.url=http://dtr-customer:4243
puris.parttypeinformation.serverendpoint=http://customer-backend:8081/catena/parttype
puris.generatematerialcatenaxid=true

edc.controlplane.key=${EDC_API_PW}
Expand Down
6 changes: 1 addition & 5 deletions local/tractus-x-edc/config/supplier/puris-backend.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
server.port=8082
puris.demonstrator.role=supplier
puris.edr.endpoint=http://supplier-backend:8082/catena/edrendpoint
puris.baseurl=http://supplier-backend:8082/
puris.edr.deletiontimer=2
puris.request.serverendpoint=http://supplier-backend:8082/catena/item-stock/request
puris.request.apiassetid=request-api-asset
puris.statusrequest.serverendpoint=http://supplier-backend:8082/catena/item-stock/status
puris.statusrequest.apiassetid=statusrequest-api-asset
puris.response.serverendpoint=http://supplier-backend:8082/catena/item-stock/response
puris.response.apiassetid=response-api-asset
puris.frameworkagreement.use=true
puris.frameworkagreement.credential=FrameworkAgreement.traceability
puris.api.key=${SUPPLIER_BACKEND_API_KEY}
puris.dtr.url=http://dtr-supplier:4243
puris.parttypeinformation.serverendpoint=http://supplier-backend:8082/catena/parttype
puris.generatematerialcatenaxid=true

edc.controlplane.key=${EDC_API_PW}
Expand Down

0 comments on commit 3320d3b

Please sign in to comment.