Skip to content

Commit

Permalink
cmd/devp2p: add flag for AWS region (ethereum#22537)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored and atif-konasl committed Oct 15, 2021
1 parent 60c6980 commit dd322e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cmd/devp2p/dns_route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ var (
Name: "zone-id",
Usage: "Route53 Zone ID",
}
route53RegionFlag = cli.StringFlag{
Name: "aws-region",
Usage: "AWS Region",
Value: "eu-central-1",
}
)

type route53Client struct {
Expand All @@ -76,13 +81,14 @@ func newRoute53Client(ctx *cli.Context) *route53Client {
akey := ctx.String(route53AccessKeyFlag.Name)
asec := ctx.String(route53AccessSecretFlag.Name)
if akey == "" || asec == "" {
exit(fmt.Errorf("need Route53 Access Key ID and secret proceed"))
exit(fmt.Errorf("need Route53 Access Key ID and secret to proceed"))
}
creds := aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(akey, asec, ""))
cfg, err := config.LoadDefaultConfig(context.Background(), config.WithCredentialsProvider(creds))
if err != nil {
exit(fmt.Errorf("can't initialize AWS configuration: %v", err))
}
cfg.Region = ctx.String(route53RegionFlag.Name)
return &route53Client{
api: route53.NewFromConfig(cfg),
zoneID: ctx.String(route53ZoneIDFlag.Name),
Expand Down
7 changes: 6 additions & 1 deletion cmd/devp2p/dnscmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ var (
Usage: "Deploy DNS TXT records to Amazon Route53",
ArgsUsage: "<tree-directory>",
Action: dnsToRoute53,
Flags: []cli.Flag{route53AccessKeyFlag, route53AccessSecretFlag, route53ZoneIDFlag},
Flags: []cli.Flag{
route53AccessKeyFlag,
route53AccessSecretFlag,
route53ZoneIDFlag,
route53RegionFlag,
},
}
)

Expand Down

0 comments on commit dd322e9

Please sign in to comment.