Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 2.75 KB

README.md

File metadata and controls

58 lines (41 loc) · 2.75 KB

pwgen

Challenge: Create a password generating REST service

Docker Cloud Automated build Docker Cloud Build Status Docker Stars Build Status Reviewed by Hound

GoDoc Go Report Card codecov

GitHub GitHub tag (latest SemVer) GitHub last commit

API

Parameters

There is one endpoint /passwords with the following query parameters.

Parameter Description Default
minLength The minimum length of a password. 0
specialChars Minimum amount of special characters. 0
numbers Minimum amount of numbers. 0
amount Number of passwords that will be returned 1
swap Boolean value indicating if random vowels should be swapped for numbers false

Example:

Request /passwords?minLength=10&specialChars=3&numbers=3&amount=2

Response ["?!o\10wE9q", "h3{{v9BB3%"]

run

Following environment variables can be set

ENV Description Default Required
CERT_FILE Path to TLS cert file. cert.pem Only for docker
KEY_FILE Path to TLS unencrypted key file. key.unencrypted.pem Only for docker
PORT Port to listen on. 8443 No
GRACE_PERIOD Timeout for graceful shutdown. 5s No

docker

You can easily run pwgen with the publicly available docker image.

Because this is a password generator only HTTPS is supported and a TLS certificate and key must be provided.

Example with latest public image:

docker run -v $(pwd):/certs -e CERT_FILE=/certs/cert.pem -e KEY_FILE=/certs/key.unencrypted.pem domano/pwgen

locally

go run cmd/pwgen/main.go