added writing of local.xml with environment variables