title: Initialize Firebase Admin SDK with only environment variables in Golang
body: <p>I'm trying to <a href="https://firebase.google.com/docs/admin/setup/" rel="nofollow noreferrer">initialize the Firebase Admin SDK</a>, in go, using only environment variables (no access to a filesystem).</p>
  
  <p>I have the <code>service-account-file.json</code> file, and can get it working locally via:</p>
  
  <pre><code>export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-file.json"
  
  ...
  
  myfile.go:
  app, err := firebase.NewApp(context.Background(), nil)
  </code></pre>
  
  <p>However, I'd like to put the contents of <code>service-account-file.json</code> into an env var, and init the firebase Admin SDK with its value.</p>
  
  <p>There is an <a href="https://github.com/googleapis/google-api-go-client/issues/185" rel="nofollow noreferrer">open issue</a> that claims you can do it via <a href="https://godoc.org/golang.org/x/oauth2/google#CredentialsFromJSON" rel="nofollow noreferrer">CredentialsFromJSON</a>, however I can't quite figure it out.</p>
  
  <p>Does anyone have this working? If so can you please provide an example?</p>