Support expansion of environment variables and write back to config