1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-06-15 00:15:15 +02:00

Load AWS region from meta data if not set for deploy

This commit is contained in:
Lee Brown
2019-07-14 00:41:58 -08:00
parent 1952c9d731
commit db07498192
7 changed files with 15 additions and 22 deletions

View File

@ -73,7 +73,6 @@ func main() {
log := log.New(os.Stdout, service+" : ", log.LstdFlags|log.Lmicroseconds|log.Lshortfile)
// =========================================================================
// Configuration
var cfg struct {
@ -94,7 +93,7 @@ func main() {
Project string `default:"" envconfig:"PROJECT"`
BaseUrl string `default:"" envconfig:"BASE_URL" example:"http://api.eproc.tech"`
HostNames []string `envconfig:"HOST_NAMES" example:"alternative-subdomain.eproc.tech"`
EnableHTTPS bool `default:"false" envconfig:"ENABLE_HTTPS"`
EnableHTTPS bool `default:"false" envconfig:"ENABLE_HTTPS"`
TemplateDir string `default:"./templates" envconfig:"TEMPLATE_DIR"`
DebugHost string `default:"0.0.0.0:4000" envconfig:"DEBUG_HOST"`
ShutdownTimeout time.Duration `default:"5s" envconfig:"SHUTDOWN_TIMEOUT"`
@ -162,7 +161,6 @@ func main() {
return // We displayed help.
}
// =========================================================================
// Config Validation & Defaults
@ -205,7 +203,6 @@ func main() {
cfg.Service.EnableHTTPS = true
}
// Determine the primary host by parsing host from the base app URL.
baseSiteUrl, err := url.Parse(cfg.Service.BaseUrl)
if err != nil {
@ -223,7 +220,6 @@ func main() {
primaryServiceHost = baseSiteUrl.Host
}
// =========================================================================
// Log Service Info
@ -243,7 +239,6 @@ func main() {
log.Printf("main : Config : %v\n", string(cfgJSON))
}
// =========================================================================
// Init AWS Session
var awsSession *session.Session
@ -267,7 +262,6 @@ func main() {
awsSession = awstrace.WrapSession(awsSession)
}
// =========================================================================
// Start Redis
// Ensure the eviction policy on the redis cluster is set correctly.
@ -301,7 +295,6 @@ func main() {
}
}
// =========================================================================
// Start Database
var dbUrl url.URL
@ -352,7 +345,6 @@ func main() {
log.Fatalf("main : Constructing authenticator : %+v", err)
}
// =========================================================================
// Load middlewares that need to be configured specific for the service.
@ -376,7 +368,6 @@ func main() {
serviceMiddlewares = append(serviceMiddlewares, redirect)
}
// =========================================================================
// Start Tracing Support
th := fmt.Sprintf("%s:%d", cfg.Trace.Host, cfg.Trace.Port)
@ -398,7 +389,6 @@ func main() {
}()
}
// =========================================================================
// ECS Task registration for services that don't use an AWS Elastic Load Balancer.
err = devops.EcsServiceTaskInit(log, awsSession)
@ -503,7 +493,6 @@ func main() {
}()
}
// =========================================================================
// Shutdown