Skip to content

Commit

Permalink
Merge pull request #34 from kanmu/add_DMTS_CLUSTER
Browse files Browse the repository at this point in the history
Add DMTS_CLUSTER env
  • Loading branch information
winebarrel committed May 27, 2023
2 parents 9f028a7 + 22abebd commit 33144e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Flags:
-c, --container-overrides=STRING
JSON/YAML string that overrides ECS container
definition.
--cluster=STRING ECS cluster name ($DMTS_CLUSTER).
Commands:
run --ecspresso-cmd="ecspresso" --conf-dir="~/.demitas" --config="ecspresso.yml" --container-def="ecs-container-def.jsonnet"
Expand Down
13 changes: 10 additions & 3 deletions definition/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type DefinitionOpts struct {
ServiceOverrides string `short:"s" help:"JSON/YAML string that overrides ECS service definition."`
TaskOverrides string `short:"t" help:"JSON/YAML string that overrides ECS task definition."`
ContainerOverrides string `short:"c" help:"JSON/YAML string that overrides ECS container definition."`
Cluster string `env:"DMTS_CLUSTER" help:"ECS cluster name."`
}

type Definition struct {
Expand Down Expand Up @@ -87,10 +88,16 @@ func (opts *DefinitionOpts) Load(profile string, command string, image string, c
return nil, err
}

cluster, err := ecspressoConf.get("cluster")
var cluster string

if err != nil {
return nil, err
if opts.Cluster != "" {
cluster = opts.Cluster
} else {
cluster, err = ecspressoConf.get("cluster")

if err != nil {
return nil, err
}
}

return &Definition{
Expand Down

0 comments on commit 33144e5

Please sign in to comment.