It would be nice if node and ruby applications can use the same configuration environment variables, and same preceding logic. In my particular project I'm using two variables: DATASTORE_EMULATOR_HOST and GCLOUD_KEYFILE_JSON. First have higher priority. If it is unset, datastore client goes to service endpoint specified by content of GCLOUD_KEYFILE_JSON. For node application I need to implement it myself
See how it is used here for example: https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/ea2be47beb32615b2bf69f8a846a684f86c8328c/google-cloud-datastore/lib/google/cloud/datastore/credentials.rb