googleapis/google-cloud-cpp-spanner

Consider introducing an environment variable for default endpoint

tmatsuo opened this issue · 3 comments

Sometimes we need to develop features with using custom endpoint. It might be useful if our clients refers to an environment variable like GOOGLE_CLOUD_CPP_SPANNER_DEFAULT_ENDPOINT and use that endpoint.

FTR, I think this sounds like a good idea.

If we had this environment variable, would we even need the ConnectionOptions::set_endpoint() method at all anymore? Maybe we could just get rid of it. Is there any reason that a customer (or even us) would need/want to set the endpoint in code?

This might be an edge case, but recently I needed to change the endpoint for some client objects in the test suite. In that case, I needed to use the ConnectionOptions::set_endpoint(). Of course, you can set/unset environment variables for the same effect, but I don't think it's ideal.