Skip to content

Commit c10156b

Browse files
committed
chore: wip
1 parent f333186 commit c10156b

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

.stacks/core/cloud/src/cloud.ts

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ import {
1919
import { hasFiles } from '@stacksjs/storage'
2020
import { path as p } from '@stacksjs/path'
2121
import { app, cloud } from '@stacksjs/config'
22-
import { env } from '@stacksjs/env'
23-
24-
type BehaviorOptions = {
25-
docsBucket?: s3.Bucket
26-
originAccessIdentity?: cloudfront.OriginAccessIdentity
27-
}
2822

2923
export class StacksCloud extends Stack {
3024
domain: string
@@ -95,7 +89,7 @@ export class StacksCloud extends Stack {
9589
})
9690
}
9791

98-
deployApi() {
92+
deployApi(): lambda.FunctionUrl {
9993
const layer = new lambda.LayerVersion(this, 'StacksLambdaLayer', {
10094
code: lambda.Code.fromAsset(p.projectStoragePath('framework/cloud/bun-lambda-layer.zip')),
10195
compatibleRuntimes: [lambda.Runtime.PROVIDED_AL2],
@@ -197,31 +191,6 @@ export class StacksCloud extends Stack {
197191
}
198192
}
199193

200-
addOutputs() {
201-
new Output(this, 'AppUrl', {
202-
value: `https://${this.domain}`,
203-
description: 'The URL of the deployed application',
204-
})
205-
206-
new Output(this, 'VanityUrl', {
207-
value: this.vanityUrl,
208-
description: 'The vanity URL of the deployed application',
209-
})
210-
211-
if (this.apiVanityUrl) {
212-
new Output(this, 'ServerVanityUrl', {
213-
value: this.apiVanityUrl,
214-
description: 'The vanity URL of the deployed Stacks server.',
215-
})
216-
}
217-
218-
// Output the nameservers of the hosted zone
219-
// new Output(this, 'Nameservers', {
220-
// value: Fn.join(', ', zone.hostedZoneNameServers),
221-
// description: 'Nameservers for the application domain',
222-
// })
223-
}
224-
225194
manageDns() {
226195
// Create a Route53 record pointing to the CloudFront distribution
227196
new route53.ARecord(this, 'AliasRecord', {
@@ -341,7 +310,7 @@ export class StacksCloud extends Stack {
341310
return { cdn, originAccessIdentity, cdnCachePolicy }
342311
}
343312

344-
generateAdditionalBehaviors(options: BehaviorOptions): Record<string, cloudfront.BehaviorOptions> {
313+
generateAdditionalBehaviors(): Record<string, cloudfront.BehaviorOptions> {
345314
let behaviorOptions: Record<string, cloudfront.BehaviorOptions> = {}
346315

347316
if (this.shouldDeployApi()) {
@@ -372,7 +341,7 @@ export class StacksCloud extends Stack {
372341
...behaviorOptions,
373342
'/docs/*': {
374343
origin: new origins.S3Origin(docsBucket, {
375-
originAccessIdentity: options.originAccessIdentity,
344+
originAccessIdentity: this.originAccessIdentity,
376345
}),
377346
compress: true,
378347
allowedMethods: this.allowedMethodsFromString(cloud.cdn?.allowedMethods),
@@ -386,6 +355,31 @@ export class StacksCloud extends Stack {
386355
return behaviorOptions
387356
}
388357

358+
addOutputs(): void {
359+
new Output(this, 'AppUrl', {
360+
value: `https://${this.domain}`,
361+
description: 'The URL of the deployed application',
362+
})
363+
364+
new Output(this, 'VanityUrl', {
365+
value: this.vanityUrl,
366+
description: 'The vanity URL of the deployed application',
367+
})
368+
369+
if (this.apiVanityUrl) {
370+
new Output(this, 'ServerVanityUrl', {
371+
value: this.apiVanityUrl,
372+
description: 'The vanity URL of the deployed Stacks server.',
373+
})
374+
}
375+
376+
// Output the nameservers of the hosted zone
377+
// new Output(this, 'Nameservers', {
378+
// value: Fn.join(', ', zone.hostedZoneNameServers),
379+
// description: 'Nameservers for the application domain',
380+
// })
381+
}
382+
389383
deploy() {
390384
new s3deploy.BucketDeployment(this, 'DeployWebsite', {
391385
sources: [s3deploy.Source.asset(this.websiteSource)],

0 commit comments

Comments
 (0)