-
Notifications
You must be signed in to change notification settings - Fork 0
/
petshop.go
44 lines (38 loc) · 794 Bytes
/
petshop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"os"
"github.com/aws/aws-cdk-go/awscdk/v2"
"github.com/aws/jsii-runtime-go"
"github.com/fogfish/blueprint-serverless-golang/internal/awspetshop"
)
func vsn(app awscdk.App) string {
switch val := app.Node().TryGetContext(jsii.String("vsn")).(type) {
case string:
return val
default:
return "latest"
}
}
func main() {
//
// Global config
//
app := awscdk.NewApp(nil)
config := &awscdk.StackProps{
Env: &awscdk.Environment{
Account: jsii.String(os.Getenv("CDK_DEFAULT_ACCOUNT")),
Region: jsii.String(os.Getenv("CDK_DEFAULT_REGION")),
},
}
//
// Stack
//
vsn := vsn(app)
awspetshop.NewPetShop(app, jsii.String(fmt.Sprintf("blueprint-golang-%s", vsn)),
&awspetshop.PetShopProps{
StackProps: config,
},
)
app.Synth(nil)
}