Read upid host and port from environment, or from local public ip

Hey yifan, not sure if I'm doing everything right. Can you take a look?
Also can you tell me how I can rebuild the example-executor with this?