-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some adjustments for Storage Driver and SourceManager to run on a nodejs
server We want to use some methods from these 2 packages in our Latitude cloud and we have to make it work
- Loading branch information
1 parent
1b25797
commit 8393d36
Showing
13 changed files
with
114 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@latitude-data/source-manager": patch | ||
"@latitude-data/storage-driver": patch | ||
--- | ||
|
||
Dry resolve secrets helper function |
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
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
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
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,31 @@ | ||
export function resolveSecrets({ | ||
unresolvedSecrets, | ||
}: { | ||
unresolvedSecrets: Record<string, unknown> | ||
}) { | ||
return Object.entries(unresolvedSecrets).reduce( | ||
(acc, [key, value]) => { | ||
if (typeof value === 'object') { | ||
acc[key] = resolveSecrets({ | ||
unresolvedSecrets: value as Record<string, unknown>, | ||
}) | ||
return acc | ||
} | ||
|
||
if (typeof value === 'string' && value.startsWith('LATITUDE__')) { | ||
if (process.env[value]) { | ||
acc[key] = process.env[value] | ||
return acc | ||
} | ||
|
||
throw new Error(` | ||
Invalid configuration. Environment variable ${value} was not found in the environment. | ||
`) | ||
} | ||
|
||
acc[key] = value | ||
return acc | ||
}, | ||
{} as Record<string, unknown>, | ||
) | ||
} |
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 |
---|---|---|
|
@@ -15,6 +15,9 @@ export default { | |
], | ||
external: [ | ||
'fs', | ||
'@aws-sdk/client-s3', | ||
'@aws-sdk/lib-storage', | ||
'stream', | ||
'path', | ||
], | ||
} |
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
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
Oops, something went wrong.