Closed jcourt562 closed 3 months ago
Seems like a good idea.. @ankurdotb @BernhardFuchs what do you think?
@jcourt562 Could you also update https://github.com/decentralized-identity/universal-resolver/blob/main/docs/driver-development.md#how-to accordingly, to reflect this change in the instructions for new driver contributors?
Yes, that is a great idea. Thx for the contribution.
Seems like a good idea.. @ankurdotb @BernhardFuchs what do you think?
@jcourt562 Could you also update https://github.com/decentralized-identity/universal-resolver/blob/main/docs/driver-development.md#how-to accordingly, to reflect this change in the instructions for new driver contributors?
I have had a go at updating the steps required, feel free to adjust the wording :-)
Issue Description :
Currently the uni-resolver-web container application pulls the DID Driver locations and pattern matching expressions from the uni-resolver-web/src/main/resources/application.yml. The driver URL fields are hardcoded strings in this file tailored to a docker-compose deployment/host naming, environment. It would be preferable to inject the driver URLs into the deployment so that the uni-resolver-web image can be used in a wider range of underlying cloud deployment infrastructure. One example is AWS fargate where load balancers can use port addresses to direct traffic to different DID Driver containers. Another example is where a developer may wish to switch between instances of the same DID Method driver for testing/comparison.
Proposed Solution
In this pull request there are two fairly simple file changes:
environment
section has been created for the uni-resolver-web service. A variable for each DID pattern in uni-resolver-web/src/main/resources/application.yml has been inserted using a consistent naming scheme based on the did method. The purpose of this change is to allow .env variables to over-ride each did method driverurl
and pass these into the uni-resolver-web containers environment.url
value has been replaced with a spring property placeholder (see https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.files.property-placeholders ) utilising the original hardcodedurl
as thedefault
. This allows for the current behaviour to remain the default (i.e backwards compatible) but allow the flexibility of changing driver URLs at uni-resolver-web container runtime based on environment settings.