-
-
Notifications
You must be signed in to change notification settings - Fork 345
feat: allow using service account with environment variables #1319
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
Conversation
@@ -8,7 +8,6 @@ import { | |||
createResolver, | |||
defineNuxtModule, | |||
} from '@nuxt/kit' | |||
import type { NuxtModule } from '@nuxt/schema' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import was unused
@robokozo This PR allows registering the API session handler along the cookie minting when the service account is configured as an object |
@noook I'd like to have this feature merged! But it's not working for me right now because my service account files contain snake case entries, not camel case. Also, I think the check function can be simplified to this: export function isServiceAccountConfigured(options) {
return process.env.GOOGLE_APPLICATION_CREDENTIALS
|| (options.admin.serviceAccount?.client_email && options.admin.serviceAccount?.private_key && options.admin.serviceAccount?.project_id)
} I tried to publish my own version from the fork but the fork is outdated and needs to be synced. |
FYI I refactored the code that handles this and it should be fixed now but it's not released yet. We are allocating time for this and many more improvements for Nuxt starting next week with Firebase 🎉 . Expect the fix to be released very soon |
Oh that's great to hear! Then I'm maybe going with an in-between solution for now. Looking forward, this module is amazing and way better than what I tried some time ago. |
@dword-design IIRC, I published a version of this package at |
@noook Yeah I've seen this, thx for it! But it's not working for me, as written above the casing is different to what is in the service account JSON. And I tried to fix your change but I get errors during |
I updated the packages and it should now work with the env variable. I deprecated the serviceAccount option as it was dangerous. Let me know if it works |
@posva Currently having an issue where multiple versions of a dependency of a module (in this case lru-cache) are wrongly resolved. Just reported it. Probably a Nuxt issue. |
@posva Ok I artificially installed Why is the serviceAccount option dangerous? |
Because it leads to leaking keys. |
Attempt to resolve issue #1297:
When using environment variables to use the service account, the service account is considered as not configured if it's something else than the service account's file's path. This PR keeps the initial check of the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to determine if the service account file's path is provided, then checks if all the required fields of the service account's options are provided to consider as configured.