File tree Expand file tree Collapse file tree 3 files changed +44
-46
lines changed
packages/util-credentials/src Expand file tree Collapse file tree 3 files changed +44
-46
lines changed Original file line number Diff line number Diff line change 1+ export const ENV_PROFILE = "AWS_PROFILE" ;
2+ export const DEFAULT_PROFILE = "default" ;
3+
4+ export const getMasterProfileName = ( init : { profile ?: string } ) : string =>
5+ init . profile || process . env [ ENV_PROFILE ] || DEFAULT_PROFILE ;
Original file line number Diff line number Diff line change 1- import {
2- loadSharedConfigFiles ,
3- ParsedIniData ,
4- SharedConfigFiles ,
5- SharedConfigInit ,
6- } from "@aws-sdk/shared-ini-file-loader" ;
7-
8- export const ENV_PROFILE = "AWS_PROFILE" ;
9- export const DEFAULT_PROFILE = "default" ;
10-
11- export interface SourceProfileInit extends SharedConfigInit {
12- /**
13- * The configuration profile to use.
14- */
15- profile ?: string ;
16-
17- /**
18- * A promise that will be resolved with loaded and parsed credentials files.
19- * Used to avoid loading shared config files multiple times.
20- *
21- * @internal
22- */
23- loadedConfig ?: Promise < SharedConfigFiles > ;
24- }
25-
26- /**
27- * Load profiles from credentials and config INI files and normalize them into a
28- * single profile list.
29- *
30- * @internal
31- */
32- export const parseKnownFiles = async ( init : SourceProfileInit ) : Promise < ParsedIniData > => {
33- const { loadedConfig = loadSharedConfigFiles ( init ) } = init ;
34-
35- const parsedFiles = await loadedConfig ;
36- return {
37- ...parsedFiles . configFile ,
38- ...parsedFiles . credentialsFile ,
39- } ;
40- } ;
41-
42- /**
43- * @internal
44- */
45- export const getMasterProfileName = ( init : { profile ?: string } ) : string =>
46- init . profile || process . env [ ENV_PROFILE ] || DEFAULT_PROFILE ;
1+ export * from "./get-master-profile-name" ;
2+ export * from "./parse-known-profiles" ;
Original file line number Diff line number Diff line change 1+ import {
2+ loadSharedConfigFiles ,
3+ ParsedIniData ,
4+ SharedConfigFiles ,
5+ SharedConfigInit ,
6+ } from "@aws-sdk/shared-ini-file-loader" ;
7+
8+ export interface SourceProfileInit extends SharedConfigInit {
9+ /**
10+ * The configuration profile to use.
11+ */
12+ profile ?: string ;
13+
14+ /**
15+ * A promise that will be resolved with loaded and parsed credentials files.
16+ * Used to avoid loading shared config files multiple times.
17+ *
18+ * @internal
19+ */
20+ loadedConfig ?: Promise < SharedConfigFiles > ;
21+ }
22+
23+ /**
24+ * Load profiles from credentials and config INI files and normalize them into a
25+ * single profile list.
26+ *
27+ * @internal
28+ */
29+ export const parseKnownFiles = async ( init : SourceProfileInit ) : Promise < ParsedIniData > => {
30+ const { loadedConfig = loadSharedConfigFiles ( init ) } = init ;
31+
32+ const parsedFiles = await loadedConfig ;
33+ return {
34+ ...parsedFiles . configFile ,
35+ ...parsedFiles . credentialsFile ,
36+ } ;
37+ } ;
You can’t perform that action at this time.
0 commit comments