diff --git a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs
index 359c7050aa59..5f8dfc5b5510 100644
--- a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs
+++ b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.hbs
@@ -3,10 +3,14 @@
SPDX-License-Identifier: BUSL-1.1
}}
-{{#let @list as |SNL|}}
-
+{{#let @list (env "CONSUL_HCP_URL") as |SNL hcpUrl|}}
+ {{log hcpUrl}}
+ {{#if (and SNL hcpUrl)}}
+
+ {{/if}}
{{/let}}
\ No newline at end of file
diff --git a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js
index 92d0e1e0b0f3..0ffb7c48583f 100644
--- a/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js
+++ b/ui/packages/consul-hcp/app/components/consul/hcp/home/index.test.js
@@ -41,7 +41,40 @@ module('Integration | Component | consul hcp home', function(hooks) {
`);
+ assert.dom('[data-test-back-to-hcp]').isVisible();
assert.dom('a').hasAttribute('href', 'http://hcp');
});
+
+ test('it does not output the Back to HCP link if CONSUL_HCP_URL is not present', async function(assert) {
+ // temporary registration until we are running as separate applications
+ this.owner.register(
+ 'component:consul/hcp/home',
+ ConsulHcpHome
+ );
+ //
+
+ const Helper = this.owner.resolveRegistration('helper:env');
+ this.owner.register(
+ 'helper:env',
+ class extends Helper {
+ compute([name, def]) {
+ switch(name) {
+ case 'CONSUL_HCP_URL':
+ return undefined;
+ }
+ return super.compute(...arguments);
+ }
+ }
+ );
+
+ await render(hbs`
+
+
+
+ `);
+
+ assert.dom('[data-test-back-to-hcp]').doesNotExist();
+ assert.dom('a').doesNotExist();
+ });
});