Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{' #916

Open
imherrera opened this issue Feb 21, 2024 · 1 comment
Open

Comments

@imherrera
Copy link

Is your feature request related to a problem? Please describe.
I do not want to commit my credentials file to github, and when running my app inside another enviroment such as Heroku, i run into the trouble because even though i can specify ENV variables i must provide a file path for GOOGLE_APPLICATION_CREDENTIALS, which is inconvenient because im using git to deploy to heroku

Describe the solution you'd like
Parse GOOGLE_APPLICATION_CREDENTIALS as JSON if it begins with '{', otherwise assume is a file path.

Describe alternatives you've considered
Adding additional code that reads an env var which contains the credential json, this is inconvenient because i will need to copy and paste this code for all my projects that use firebase admin

        fun createApp(): FirebaseApp {
            val credentials = System.getenv("FIREBASE_CONFIG")
                .byteInputStream()
                .use { stream -> ServiceAccountCredentials.fromStream(stream) }
            val config = FirebaseOptions.builder()
                .setCredentials(credentials)
                .build()
            return FirebaseApp.initializeApp(config)
        }
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants