File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ const S3Notifier = require('fastboot-s3-notifier');
13
13
14
14
let notifier = new S3Notifier ({
15
15
bucket: S3_BUCKET ,
16
- key: S3_KEY
16
+ key: S3_KEY ,
17
+ region: AWS_REGION // optional
17
18
});
18
19
19
20
let server = new FastBootAppServer ({
Original file line number Diff line number Diff line change @@ -4,11 +4,6 @@ const AWS = require('aws-sdk');
4
4
5
5
const DEFAULT_POLL_TIME = 3 * 1000 ;
6
6
7
- const s3 = new AWS . S3 ( {
8
- apiVersion : '2006-03-01' ,
9
- signatureVersion : 'v4'
10
- } ) ;
11
-
12
7
class S3Notifier {
13
8
constructor ( options ) {
14
9
this . ui = options . ui ;
@@ -20,6 +15,12 @@ class S3Notifier {
20
15
Bucket : this . bucket ,
21
16
Key : this . key
22
17
} ;
18
+
19
+ this . s3 = new AWS . S3 ( {
20
+ apiVersion : '2006-03-01' ,
21
+ signatureVersion : 'v4' ,
22
+ region : options . region
23
+ } ) ;
23
24
}
24
25
25
26
subscribe ( notify ) {
@@ -30,7 +31,7 @@ class S3Notifier {
30
31
}
31
32
32
33
getCurrentLastModified ( ) {
33
- return s3 . headObject ( this . params ) . promise ( )
34
+ return this . s3 . headObject ( this . params ) . promise ( )
34
35
. then ( data => {
35
36
this . lastModified = data . LastModified ;
36
37
} )
@@ -46,7 +47,7 @@ class S3Notifier {
46
47
}
47
48
48
49
poll ( ) {
49
- s3 . headObject ( this . params ) . promise ( )
50
+ this . s3 . headObject ( this . params ) . promise ( )
50
51
. then ( data => {
51
52
this . compareLastModifieds ( data . LastModified ) ;
52
53
this . schedulePoll ( ) ;
You can’t perform that action at this time.
0 commit comments