A flexible and platform agnostic integration solution that can be deployed either as AWS lambda based solution, stand-alone, stand-alone docker based, or hosted virtually with any PAAS provider, e.g., Heroku, Google Cloud App Engine, Cloud Function etc. The solution based on AWS Lambda can be triggered either by SQS or API Gateway directly.
This project can server as a reference for NZ ORCID Hub integrators.
To deploy on AWS Lambda:
go build -o main ./handler/ && upx main && zip main.zip main
Docker image:
docker build -t handler .
Stand-alone executable:
go build -o server -tags 'standalone' ./handler/
export APIKEY=... CLIENT_ID=... CLIENT_SECRET=...
gotest -v .
# more verbose:
gotest -v . -args -verbose
# with 'live server' instead of using the mock:
gotest -v . -args -live
# to get coverage report (user "-tags test" to exclude Lambda specific bits from the coverage):
gotest ./... -tags test -cover -coverprofile coverage.out ; go tool cover -html=coverage.out -o coverage.html
Or create .env-file with environment variables.
# Copy this file to '.env'-file and change values
# ORCID Hub API client credentials:
CLIENT_ID=...
CLIENT_SECRET=...
# UoA API Key:
APIKEY=...
# PORT on which to server the handler (only for Docker)
PORT=5000
# you need to create **.env** file...
docker run -it --env-file .env -p "5050:5050" handler
export PORT=9090
./server