github.com/Schaudge/grailbase@v0.0.0-20240223061707-44c758a471c0/config/aws/aws.go (about)

     1  // Copyright 2019 GRAIL, Inc. All rights reserved.
     2  // Use of this source code is governed by the Apache 2.0
     3  // license that can be found in the LICENSE file.
     4  
     5  package aws
     6  
     7  import (
     8  	"github.com/aws/aws-sdk-go/aws"
     9  	"github.com/aws/aws-sdk-go/aws/session"
    10  	"github.com/Schaudge/grailbase/config"
    11  )
    12  
    13  func init() {
    14  	config.Register("aws/env", func(constr *config.Constructor[*session.Session]) {
    15  		var cfg aws.Config
    16  		cfg.Region = constr.String("region", "us-west-2", "the default AWS region for the session")
    17  		constr.Doc = "configure an AWS session from the environment"
    18  		constr.New = func() (*session.Session, error) {
    19  			return session.NewSession(&cfg)
    20  		}
    21  	})
    22  
    23  	config.Default("aws", "aws/env")
    24  }