re-up with fixes

pull request to get recent changes/fixes.

Major change in services/environements to use environments api 
plus other minor fixes.
consult cmdb.cfg to verify proper config, as config has been refactored