You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-06-15 00:15:15 +02:00
Init aws session with region when using role
This commit is contained in:
@ -247,6 +247,9 @@ func main() {
|
||||
// configuration is provided. This is useful for taking advantage of
|
||||
// EC2/ECS instance roles.
|
||||
awsSession = session.Must(session.NewSession())
|
||||
if cfg.Aws.Region != "" {
|
||||
awsSession.Config.WithRegion(cfg.Aws.Region)
|
||||
}
|
||||
|
||||
log.Printf("main : AWS : Using role.\n")
|
||||
|
||||
|
@ -238,6 +238,9 @@ func main() {
|
||||
// configuration is provided. This is useful for taking advantage of
|
||||
// EC2/ECS instance roles.
|
||||
awsSession = session.Must(session.NewSession())
|
||||
if cfg.Aws.Region != "" {
|
||||
awsSession.Config.WithRegion(cfg.Aws.Region)
|
||||
}
|
||||
|
||||
log.Printf("main : AWS : Using role.\n")
|
||||
|
||||
|
@ -183,7 +183,12 @@ func (creds awsCredentials) Session() *session.Session {
|
||||
// Get an AWS session from an implicit source if no explicit
|
||||
// configuration is provided. This is useful for taking advantage of
|
||||
// EC2/ECS instance roles.
|
||||
return session.Must(session.NewSession())
|
||||
sess := session.Must(session.NewSession())
|
||||
if creds.Region != "" {
|
||||
sess.Config.WithRegion(creds.Region)
|
||||
}
|
||||
|
||||
return sess
|
||||
}
|
||||
|
||||
return session.New(
|
||||
|
@ -726,7 +726,7 @@ func NewServiceDeployRequest(log *log.Logger, flags ServiceDeployFlags) (*servic
|
||||
|
||||
// RDS settings for a Postgres database Instance. Could defined different settings by env.
|
||||
req.DBInstance = &rds.CreateDBInstanceInput{
|
||||
DBInstanceIdentifier: aws.String(req.ProjectName + "-" + req.Env + "-01"),
|
||||
DBInstanceIdentifier: aws.String(req.ProjectName + "-" + req.Env),
|
||||
DBName: aws.String("shared"),
|
||||
Engine: aws.String("postgres"),
|
||||
MasterUsername: aws.String("god"),
|
||||
|
1
tools/schema/cmd/migrate.go
Normal file
1
tools/schema/cmd/migrate.go
Normal file
@ -0,0 +1 @@
|
||||
package cmd
|
12
tools/schema/cmd/models.go
Normal file
12
tools/schema/cmd/models.go
Normal file
@ -0,0 +1,12 @@
|
||||
package cmd
|
||||
|
||||
// DB mimics the general info needed for services used to define placeholders.
|
||||
type DB struct {
|
||||
Host string
|
||||
User string
|
||||
Pass string
|
||||
Database string
|
||||
Driver string
|
||||
DisableTLS bool
|
||||
}
|
||||
|
@ -57,6 +57,18 @@ func main() {
|
||||
return // We displayed help.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//
|
||||
DBInstanceIdentifier: aws.String(req.ProjectName + "-" + req.Env),
|
||||
|
||||
|
||||
Secret ID used to store the DB username and password across deploys.
|
||||
dbSecretId := filepath.Join(req.ProjectName, req.Env, *req.DBInstance.DBInstanceIdentifier)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// Log App Info
|
||||
|
||||
|
Reference in New Issue
Block a user