Tweak environment setup to pass $app instance.

Signed-off-by: crynobone <crynobone@gmail.com>