Lookup domain from the environment

Also lookup apps by UUID where possible.

Resolve bug https://bugzilla.redhat.com/show_bug.cgi?id=1092703