Skip to content

Commit 8781e40

Browse files
committed
chore: wip
chore: wip
1 parent af4d117 commit 8781e40

File tree

1 file changed

+10
-2
lines changed
  • storage/framework/core/cloud/src/cloud

1 file changed

+10
-2
lines changed

storage/framework/core/cloud/src/cloud/cdn.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class CdnStack {
3232
cdnCachePolicy: cloudfront.CachePolicy
3333
apiCachePolicy: cloudfront.CachePolicy | undefined
3434
vanityUrl: string
35+
realtimeLogConfig: cloudfront.RealtimeLogConfig
3536
props: CdnStackProps
3637

3738
constructor(scope: Construct, props: CdnStackProps) {
@@ -72,7 +73,7 @@ export class CdnStack {
7273
// })
7374

7475
// TODO: make this configurable
75-
const realtimeLogConfig = new cloudfront.RealtimeLogConfig(scope, 'StacksRealTimeLogConfig', {
76+
this.realtimeLogConfig = new cloudfront.RealtimeLogConfig(scope, 'StacksRealTimeLogConfig', {
7677
endPoints: [
7778
cloudfront.Endpoint.fromKinesisStream(logStream),
7879
],
@@ -119,7 +120,7 @@ export class CdnStack {
119120
cachedMethods: this.cachedMethods(),
120121
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
121122
cachePolicy: this.cdnCachePolicy,
122-
realtimeLogConfig,
123+
realtimeLogConfig: this.realtimeLogConfig,
123124
},
124125

125126
additionalBehaviors: this.additionalBehaviors(scope, props),
@@ -249,6 +250,7 @@ export class CdnStack {
249250
cachedMethods: cloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS,
250251
cachePolicy: this.setApiCachePolicy(scope),
251252
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
253+
realtimeLogConfig: this.realtimeLogConfig,
252254
},
253255
'/api/*': {
254256
origin: origin('/api/*'),
@@ -257,6 +259,7 @@ export class CdnStack {
257259
cachedMethods: cloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS,
258260
cachePolicy: this.apiCachePolicy,
259261
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
262+
realtimeLogConfig: this.realtimeLogConfig,
260263
},
261264
}
262265
}
@@ -273,6 +276,7 @@ export class CdnStack {
273276
cachedMethods: this.cachedMethodsFromString(config.cloud.cdn?.cachedMethods),
274277
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
275278
cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED,
279+
realtimeLogConfig: this.realtimeLogConfig,
276280
},
277281
'/docs/*': {
278282
origin: new origins.S3Origin(props.publicBucket, {
@@ -284,6 +288,7 @@ export class CdnStack {
284288
cachedMethods: this.cachedMethodsFromString(config.cloud.cdn?.cachedMethods),
285289
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
286290
cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED,
291+
realtimeLogConfig: this.realtimeLogConfig,
287292
},
288293
}
289294
}
@@ -312,6 +317,7 @@ export class CdnStack {
312317
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
313318
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
314319
cachePolicy: aiCachePolicy,
320+
realtimeLogConfig: this.realtimeLogConfig,
315321
},
316322
'/ai/summary': {
317323
origin: new origins.HttpOrigin(summaryHostname, {
@@ -322,6 +328,7 @@ export class CdnStack {
322328
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
323329
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
324330
cachePolicy: aiCachePolicy,
331+
realtimeLogConfig: this.realtimeLogConfig,
325332
},
326333
}
327334
}
@@ -347,6 +354,7 @@ export class CdnStack {
347354
headerBehavior: cloudfront.CacheHeaderBehavior.none(),
348355
queryStringBehavior: cloudfront.CacheQueryStringBehavior.none(),
349356
}),
357+
realtimeLogConfig: this.realtimeLogConfig, // we potentially want to allow for tracking 100% of the traffic here?
350358
},
351359
}
352360
}

0 commit comments

Comments
 (0)