@@ -14,6 +14,11 @@ module.exports = DeployPlugin.extend({
14
14
15
15
_getConfig ( context ) {
16
16
const config = Object . assign ( { } , context . config [ 'fastboot-api-lambda' ] ) ;
17
+ return config ;
18
+ } ,
19
+
20
+ _getSafeConfig ( context ) {
21
+ const config = this . _getConfig ( context ) ;
17
22
delete config . accessKeyId ;
18
23
delete config . secretAccessKey ;
19
24
return config ;
@@ -35,7 +40,7 @@ module.exports = DeployPlugin.extend({
35
40
} ,
36
41
37
42
didBuild : function ( context ) {
38
- const config = this . _getConfig ( context ) ;
43
+ const config = this . _getSafeConfig ( context ) ;
39
44
const paths = this . _getPaths ( context ) ;
40
45
41
46
const addonRootPath = paths . addonRootPath ;
@@ -70,13 +75,24 @@ module.exports = DeployPlugin.extend({
70
75
} ,
71
76
72
77
activate : function ( context ) {
73
- const config = this . _getConfig ( context ) ;
74
78
const tempPath = this . _getPaths ( context ) . tempPath ;
79
+ const config = this . _getConfig ( context ) ;
75
80
76
81
const lambdaFunction = config . lambdaFunction ;
77
- const region = config . region || DEFAULT_REGION ;
78
82
79
- const Lambda = new AWS . Lambda ( { region : region } ) ;
83
+ const lambdaConfig = {
84
+ region : config . region || DEFAULT_REGION
85
+ } ;
86
+
87
+ if ( config . accessKeyId ) {
88
+ lambdaConfig . accessKeyId = config . accessKeyId ;
89
+ }
90
+
91
+ if ( config . secretAccessKey ) {
92
+ lambdaConfig . secretAccessKey = config . secretAccessKey ;
93
+ }
94
+
95
+ const Lambda = new AWS . Lambda ( lambdaConfig ) ;
80
96
const UpdateLambdaFunc = RSVP . denodeify ( Lambda . updateFunctionCode . bind ( Lambda ) ) ;
81
97
82
98
return RSVP . resolve ( )
@@ -88,13 +104,13 @@ module.exports = DeployPlugin.extend({
88
104
. then ( ( ) => fs . readFile ( `${ tempPath } .zip` ) )
89
105
90
106
. then ( fileBuf => {
91
- this . log ( `3/3. Uploading zip to ${ lambdaFunction } lambda to ${ region } region` ) ;
107
+ this . log ( `3/3. Uploading zip to ${ lambdaFunction } lambda to ${ lambdaConfig . region } region` ) ;
92
108
return UpdateLambdaFunc ( {
93
109
FunctionName : lambdaFunction ,
94
110
ZipFile : fileBuf
95
111
} ) ;
96
112
} )
97
113
98
- . then ( ( ) => this . log ( `API FastBoot lambda production bundle successfully uploaded to "${ lambdaFunction } " lambda in region "${ region } " 🚀` ) ) ;
114
+ . then ( ( ) => this . log ( `API FastBoot lambda production bundle successfully uploaded to "${ lambdaFunction } " lambda in region "${ lambdaConfig . region } " 🚀` ) ) ;
99
115
}
100
116
} ) ;
0 commit comments