flatten generate_cert.sh by removing function wrapper.
make generate_cert.sh re-runnable by removing $db before each run