-
Notifications
You must be signed in to change notification settings - Fork 56
feat: Google Drive Integration #612
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
Draft
nora-weisser
wants to merge
1
commit into
main
Choose a base branch
from
feature/drive
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Based on what I checked that is not the best solution because we need to upload the json account for each deployment in fly.io so it is not so simple to make this.
Optional future extension:
Code changes
Modify:
src/main/java/com/wcc/platform/repository/googledrive/GoogleDriveFileStorageRepository.javaAdd:
src/main/java/com/wcc/platform/properties/GoogleDriveAuthProperties.javaImplementation direction:
AuthorizationCodeInstalledAppflow from productionGOOGLE_DRIVE_CREDENTIALS_PATHDriveclient from those credentials directlyThe production code should fail fast at startup if:
storage.type=google2. Google Drive: support profile-based auth modes
Recommended split:
local: allow local filesystem storage by defaultdev: optionally use service-account-based Google Drive if the developer hasthe credentials file locally
prodorflyio: only allow service-account modeThis avoids production inheriting local OAuth assumptions.
3. Add startup validation
Add validation so the app fails fast when production configuration is invalid.
Examples:
storage.type=googleandGOOGLE_DRIVE_CREDENTIALS_PATHis missingspring.mail.hostis set butMAIL_USERNAMEorMAIL_PASSWORDis blankThis can be implemented with:
@ConfigurationProperties@ValidatedGoogle Drive Service Account Setup
1. Create the service account
In Google Cloud Console:
IAM & Admin->Service Accountswcc-backend-drive-prodDo not commit this file to the repository.
2. Share the Drive folders with the service account
This is the critical step that replaces the desktop OAuth user flow.
For each required Google Drive folder:
Typical minimum access:
Editorfor upload/update flowsShare:
3. Record the folder IDs [DONE AND UPDATED TO PROD]
Use the same folder IDs already expected by the app:
These should remain configuration values, not code constants.
Fly.io Setup
Google Drive secrets
Store the service account JSON in Fly secrets.
Example:
At startup:
/app/secrets/app/secrets/google-drive-service-account.jsonThis requires either:
Suggested Fly startup flow
Create a startup script that:
/app/secretsGOOGLE_DRIVE_CREDENTIALS_JSON_B64into the credentials fileExample outline:
This is acceptable in production because:
Recommended Development Setup
Local development for Google Drive
Best default:
storage.type=localThis avoids forcing every developer to configure Google Drive credentials just
to run the app.
If a developer needs to test real Google Drive integration locally:
GOOGLE_DRIVE_CREDENTIALS_PATHat that local fileDo not rely on desktop OAuth as the long-term supported path.
Testing Plan
Dev environment tests
Google Drive
storage.type=googleGOOGLE_DRIVE_CREDENTIALS_PATHto a valid local service account fileNegative tests:
Production tests
Google Drive
Operational checks:
Recommended Implementation Sequence
/credentials.jsonclasspath resourcelimits become operationally restrictive
Final Recommendation
Google Drive
Real production fix: