Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
Release 4.3.1. Fixed secureConfig.fetchFromS3ByEnvVar not taking bu…
Browse files Browse the repository at this point in the history
…cket name by env var.
  • Loading branch information
jeff committed Oct 19, 2017
1 parent e9081a7 commit 84ab377
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/secureConfig/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "babel-polyfill";
export { AuthenticationConfig } from "./AuthenticationConfig";
export declare function fetchFromS3<T>(bucket: string, key: string): Promise<T>;
export declare function fetchFromS3ByEnvVar<T>(bucket: string, envVar: string): Promise<T>;
export declare function fetchFromS3ByEnvVar<T>(bucketEnvVar: string, keyEnvVar: string): Promise<T>;
13 changes: 8 additions & 5 deletions dist/secureConfig/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/secureConfig/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "giftbit-cassava-routes",
"version": "4.3.0",
"version": "4.3.1",
"description": "Private Giftbit routes for use with Cassava.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
13 changes: 8 additions & 5 deletions src/secureConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ export async function fetchFromS3<T>(bucket: string, key: string): Promise<T> {
}
}

export async function fetchFromS3ByEnvVar<T>(bucket: string, envVar: string): Promise<T> {
if (!process || !process.env[envVar]) {
console.error(`${envVar} is not set. The secure config item cannot be fetched.`);
export async function fetchFromS3ByEnvVar<T>(bucketEnvVar: string, keyEnvVar: string): Promise<T> {
if (!process || !process.env[bucketEnvVar]) {
console.error(`${bucketEnvVar} is not set. The secure config item cannot be fetched.`);
return null;
}
if (!process || !process.env[keyEnvVar]) {
console.error(`${keyEnvVar} is not set. The secure config item cannot be fetched.`);
return null;
}

console.log(`Secure config env var ${envVar} = ${process.env[envVar]}.`);
return await fetchFromS3<T>(bucket, process.env[envVar]);
return await fetchFromS3<T>(process.env[bucketEnvVar], process.env[keyEnvVar]);
}

0 comments on commit 84ab377

Please sign in to comment.