Permalink
Browse files

update for env

  • Loading branch information...
peter-edge committed Nov 3, 2015
1 parent 6f677be commit e62034328b4243fb475d5a47fa3d93eed192c3fb
Showing with 6 additions and 16 deletions.
  1. +1 −1 common/aws/commonaws.go
  2. +1 −1 ecs-list-ips/main.go
  3. +3 −13 protoc-all/main.go
  4. +1 −1 sqs-purge/main.go
@@ -22,7 +22,7 @@ func Do(f func(*aws.Config) error) error {

func getAWSConfig() (*aws.Config, error) {
var awsEnv awsEnv
if err := env.Populate(&awsEnv, env.PopulateOptions{}); err != nil {
if err := env.Populate(&awsEnv); err != nil {
return nil, err
}
return &aws.Config{
@@ -27,7 +27,7 @@ func main() {

func do(awsConfig *aws.Config) error {
var appEnv appEnv
if err := env.Populate(&appEnv, env.PopulateOptions{}); err != nil {
if err := env.Populate(&appEnv); err != nil {
return err
}
ecsClient := ecs.New(awsConfig)
@@ -27,9 +27,6 @@ var (
"type.proto",
"wrappers.proto",
}
defaultEnv = map[string]string{
"PROTOLOG_FILE_NAME": "protolog.proto",
}
)

type appEnv struct {
@@ -39,22 +36,15 @@ type appEnv struct {
}

func main() {
if err := do(); err != nil {
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
os.Exit(1)
}
os.Exit(0)
env.Main(do, &appEnv{})
}

func do() error {
func do(appEnvObj interface{}) error {
appEnv := appEnvObj.(*appEnv)
if len(os.Args) != 2 {
return fmt.Errorf("usage: %s go-package", os.Args[0])
}
basePackagePath := os.Args[1]
appEnv := &appEnv{}
if err := env.Populate(appEnv, env.PopulateOptions{Defaults: defaultEnv}); err != nil {
return err
}
protocBasePath, err := os.Getwd()
if err != nil {
return err
@@ -24,7 +24,7 @@ func main() {

func do(awsConfig *aws.Config) error {
var appEnv appEnv
if err := env.Populate(&appEnv, env.PopulateOptions{}); err != nil {
if err := env.Populate(&appEnv); err != nil {
return err
}
sqsClient := sqs.New(awsConfig)

0 comments on commit e620343

Please sign in to comment.