Public | Automated Build

Last pushed: 5 months ago
Short Description
password generator API - automated build
Full Description


API to generate secure passwords


default.toml stores minimum default required settings for generated passwords

Currently it contains two sections:

min_length = 8
min_special_characters = 2
min_digits = 2
min_lowercase = 1
min_uppercase = 1
results = 1

min_length = 16
min_special_characters = 4
min_digits = 4
min_lowercase = 2
min_uppercase = 2
results = 1

You can choose which section should be loaded as default one, in init.go:

passwordType = "default"

Each of the params can be overwritten from the url.

Running as a server

I recommend to use docker:

docker run --rm -p 8080:8080 --name=passgen rafalgolarz/passgen

or run the dev version:

docker run --rm -p 8080:8080 --name=passgen rafalgolarz/passgen:dev

You can also build a docker image locally:

docker build -f Dockerfile-dev -t rafalgolarz/passgen .
docker run --rm -p 8080:8080 --name=passgen rafalgolarz/passgen

Dockerfile-dev has debug flags on. Use Dockerfile to have them off or set them with -e param:

Next, open the url:


By default, it generates one password meeting criteria defined in passgen.toml but you can overwrite any of the params.

Generate 3 passwords:


Generate 20 passwords. Each of the passwords should have:

  • minimum length of 25 characters
  • minimum of 2 special characters
  • minimum of 2 digits
  • minimum 4 lower and 4 upper case letters


Running as a command line app

go install

that will install it as an executable file in your $GOBIN directory.

If you don't have $GOBIN path set up, check out $GOPATH/bin

Running tests

cd $GOPATH/src/
go test -v ./... -bench=./...

If you don't know/have $GOPATH, run go env to display all Go enviromental variables

Deploying to Kubernetes

In k8s folder, you can find sample kubernetes manifests that can help you to deploy it to your K8s cluster.

I recommend to use different namespaces for dev and production versions.

To create two new namespaces (dev and production) you can use my yaml files:

kubectl create -f k8s/production/production-ns.yaml
kubectl create -f k8s/dev/dev-ns.yaml

List available namespaces:

kubectl get ns

Deploy passgen API to dev namespace:

kubectl -n dev apply -f k8s/dev/api-passgen-deployment.yaml
kubectl -n dev apply -f k8s/api-passgen-svc.yaml

Deploy passgen API to production namespace:

kubectl -n production apply -f k8s/production/api-passgen-deployment.yaml
kubectl -n production apply -f k8s/api-passgen-svc.yaml

Once everything is up and running, you can access the API through kubectl proxy:

kubectl proxy

If you deployed it to the dev namespace, open the url for dev:

If you deployed it to the production namespace, open the url for production:


  • [ ] display just array of passwords (hide configuration info) by setting a new boolean param verbose to false
  • [ ] add tests checking if the length of required subsets of characters match passed values
Docker Pull Command
Source Repository