Service to support requesting a password hash that can be retrieved on a separate http
call.
- Get the source with
go get github.com/jakepearson/jcpassword
- Run the service with
go build main.go && main
orgo run main.go
- The service should now be running on your machine. The endpoints are defined below.
- To override the default port of
8080
, set thePORT
environment variable - All commits trigger a build job on CircleCI
- If all tests pass, the source is pushed to Heroku for deployment to the production instance (https://jakepearson-password.herokuapp.com/)
- Run the tests with
go test ./...
/hash
(POST): Request that a string is hashed withSHA512
andbase64
encoded. To use, call to the endpoint with a body of the formatpassword=<your-password>
AHashID
is returned that can be used to lookup the final result./hash/<HashID>
(GET): Request for the final result of the hash and encode operation. If the operation is complete, a status code of200
will be returned with the hashed and encoded string in the body of the response. If the operation is not yet complete, a status code of400
(Bad request) will return with a message./shutdown
(GET): Request for the service to shutdown. The service will stop accepting requests, complete any open requests, and finally shutdown the process after5
seconds./metrics
(GET): Request for simple metrics about the service. Returns ajson
string with fields fortotal
andaverage
in milliseconds.
- Change
/hash
endpoint to return the fullurl
oruri
to get the hash instead of just anid
- Replace in memory hash database with a DB that can survive restarts. We could then run multiple service instances and do rolling deploys
- Replace homegrown metrics system with something like Prometheus
- Switch from Heroku logging to a different SaaS service with better performance and search capabilities
- Render output into
JUnit
format in CircleCI - Implement a Swagger document and UI to make the service easier to discover and understand