add pgparam in middleware.
add cli testcases.
let ensured-opts to check prefix, port, host.