2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2018-09-12 19:23:39 +00:00
|
|
|
import { helper } from '@ember/component/helper';
|
|
|
|
import { get } from '@ember/object';
|
|
|
|
|
|
|
|
export function serviceExternalSource(params, hash) {
|
|
|
|
let source = get(params[0], 'ExternalSources.firstObject');
|
|
|
|
if (!source) {
|
|
|
|
source = get(params[0], 'Meta.external-source');
|
|
|
|
}
|
|
|
|
const prefix = typeof hash.prefix === 'undefined' ? '' : hash.prefix;
|
2021-11-10 21:54:12 +00:00
|
|
|
if (
|
|
|
|
source &&
|
2022-09-14 17:38:03 +00:00
|
|
|
[
|
|
|
|
'consul-api-gateway',
|
|
|
|
'vault',
|
|
|
|
'kubernetes',
|
|
|
|
'terraform',
|
|
|
|
'nomad',
|
|
|
|
'consul',
|
|
|
|
'aws',
|
2022-09-20 14:34:08 +00:00
|
|
|
'lambda',
|
|
|
|
].includes(source)
|
2021-11-10 21:54:12 +00:00
|
|
|
) {
|
2018-09-12 19:23:39 +00:00
|
|
|
return `${prefix}${source}`;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default helper(serviceExternalSource);
|