Skip to content

Commit

Permalink
Change precedence for CPLN_ORG_UPSTREAM env var in `copy-image-from…
Browse files Browse the repository at this point in the history
…-upstream` command (#137)

* feat: change precedence for CPLN_ORG_UPSTREAM
  • Loading branch information
rafaelgomesxyz authored Jan 22, 2024
1 parent 93fa1ee commit ea50ba6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ _Please add entries here for your pull requests that are not yet released._
### Changed

- `build-image` command now accepts extra options and passes them to `docker build`. [PR 126](https://github.com/shakacode/heroku-to-control-plane/pull/126) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
- `CPLN_ORG_UPSTREAM` env var now takes precedence over config from `controlplane.yml` in `copy-image-from-upstream` command. [PR 137](https://github.com/shakacode/heroku-to-control-plane/pull/137) by [Rafael Gomes](https://github.com/rafaelgomesxyz).

## [1.2.0] - 2024-01-03

Expand Down
2 changes: 1 addition & 1 deletion lib/command/copy_image_from_upstream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def call # rubocop:disable Metrics/MethodLength
ensure_docker_running!

@upstream = config[:upstream]
@upstream_org = config.find_app_config(@upstream)&.dig(:cpln_org) || ENV.fetch("CPLN_ORG_UPSTREAM", nil)
@upstream_org = ENV.fetch("CPLN_ORG_UPSTREAM", nil) || config.find_app_config(@upstream)&.dig(:cpln_org)
ensure_upstream_org!

create_upstream_profile
Expand Down
1 change: 1 addition & 0 deletions spec/command/copy_image_from_upstream_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
allow(ENV).to receive(:fetch).with("CPLN_ENDPOINT", "https://api.cpln.io").and_return("https://api.cpln.io")
allow(ENV).to receive(:fetch).with("CPLN_TOKEN", nil).and_return("token")
allow(ENV).to receive(:fetch).with("CPLN_ORG", nil).and_return(nil)
allow(ENV).to receive(:fetch).with("CPLN_ORG_UPSTREAM", nil).and_return(nil)
allow(ENV).to receive(:fetch).with("CPLN_APP", nil).and_return(nil)
allow_any_instance_of(Config).to receive(:config_file_path).and_return("spec/fixtures/config.yml")
allow_any_instance_of(described_class).to receive(:ensure_docker_running!)
Expand Down

0 comments on commit ea50ba6

Please sign in to comment.