<p>We use the method in the first code block in java, but I don't see a corresponding method in the <a href="https://www.rubydoc.info/gems/google-cloud-storage/0.24.0/Google%2FCloud%2FStorage.new" rel="nofollow noreferrer">rails documentation</a>, Only the second code block:</p>

<p><code>Storage storage = StorageOptions.getDefaultInstance().getService();</code></p>

<pre><code>storage = Google::Cloud::Storage.new(
  project: "my-todo-project",
  keyfile: "/path/to/keyfile.json"
)
</code></pre>

<p>If we use an application specific service account in the kubernetes cluster. How do we configure the Rails application to work in the local developer environment and also run with a k8s cluster?</p>

<p>Also, I would prefer not to use a project_id and a keyfile to initialize, since I will have to manage multiple such JSON files during the initialization process in dev, qa, staging, production environments.</p>

<p>I would recommend initializing without arguments and using the default discovery of credentials as discussed in the <a href="https://googleapis.dev/ruby/google-cloud-storage/latest/file.AUTHENTICATION.html" rel="nofollow noreferrer">Authentication guide</a>.</p>

<blockquote>
  <p>When running on Google Cloud Platform (GCP), including Google Compute Engine (GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions (GCF) and Cloud Run, the credentials will be discovered automatically.</p>
</blockquote>

<p>For the local developer environment, we always use environment variables with initializing without arguments and the default discovery.</p>
