-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable cloud service entries if no certain env exist
- Loading branch information
1 parent
c4631ac
commit 3f7e4e8
Showing
3 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function isOnedriveEnabled() { | ||
return Boolean(import.meta.env.VITE_ONEDRIVE_CLIENT_ID) | ||
} | ||
|
||
function isGoogleDriveEnabled() { | ||
return ( | ||
Boolean(import.meta.env.VITE_GOOGLE_DRIVE_CLIENT_ID) && | ||
Boolean(import.meta.env.VITE_GOOGLE_DRIVE_CLIENT_SECRET) && | ||
Boolean(import.meta.env.VITE_GOOGLE_DRIVE_API_KEY) | ||
) | ||
} | ||
|
||
type CloudService = 'onedrive' | 'google-drive' | ||
|
||
export function isCloudServiceEnabled(cloudService: CloudService) { | ||
if (cloudService === 'onedrive') { | ||
return isOnedriveEnabled() | ||
} | ||
if (cloudService === 'google-drive') { | ||
return isGoogleDriveEnabled() | ||
} | ||
return false | ||
} |
This file contains 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