openwallet-foundation / acapy-endorser-service

endorser-service
https://wiki.hyperledger.org/display/aries
Apache License 2.0
6 stars 11 forks source link

Enhancement: Introduce Support for Uploading CSV-Based Configuration #37

Closed Gavinok closed 1 year ago

Gavinok commented 1 year ago

This pull request resolves #38

This enhancement adds the capability to configure your application using CSV files. The configuration is structured around the following classes:

This enhancement enables you to upload CSV files associated with each of these classes, using either the POST or PUT methods. The choice between POST and PUT dictates how the uploaded data interacts with the existing configuration:

POST: This method will replace the current configuration with the data from the uploaded CSV file.

PUT: In contrast, the PUT method appends the data from the CSV file to the existing configuration, preserving the current state.

This feature enhances the flexibility and ease of configuring your application by allowing you to manage your configuration using CSV files effortlessly.

2023-10-16_15-22-15

These enhancements are designed to make your application's configuration management more user-friendly and efficient.

The fields of these CSVs follow the format used in the POST /allow/{publish-data,schema,credential-definition} endpoints

For example the description for the POST /allow/schema endpoint is

Name Description default
author_did string Default value : *
schema_name string Default value : *
version string Default value : *

and the csv equivalent is

author_did,schema_name,version
"3fa85f64-5717-4562-b3fc-2c963f66afa6","myschema","1.0"

NOTE: All string arguments must be quoted

To append this to the endorsers list of allowed schemas the corresponding curl command would be

curl -X 'PUT' \
  'http://ENDORSERURL/v1/allow/config' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN_HERE' \
  -H 'Content-Type: multipart/form-data' \
  -F 'publish_did=' \
  -F 'schema=@YOURFILE.csv' \
  -F 'credential_definition='

For the updated descriptions of the allow lists start the endorser service and open http://localhost:5050/endorser/docs in your browser

The POST /allow/{publish-data,schema,credential-definition} describe the correspoinding csv file format.