code: public static DatastoreOptions.Builder getOptionsFromEnv()
        throws GeneralSecurityException, IOException {
      DatastoreOptions.Builder options = new DatastoreOptions.Builder();
      setProjectEndpointFromEnv(options);
      options.credential(getCredentialFromEnv());
      return options;
    }
docs: Constructs a {@link Datastore} from environment variables and/or the Compute Engine metadata
  server.
  
  <p>The project ID is determined from, in order of preference:
  <ul>
  <li>DATASTORE_PROJECT_ID environment variable
  <li>Compute Engine
  </ul>
  
  <p>Credentials are taken from, in order of preference:
  <ol>
  <li>No credentials (if the DATASTORE_EMULATOR_HOST environment variable is set)
  <li>Service Account specified by the DATASTORE_SERVICE_ACCOUNT and DATASTORE_PRIVATE_KEY_FILE
  environment variables
  <li>Google Application Default as described at
  {@link "https://developers.google.com/identity/protocols/application-default-credentials"}
  </ol>