2023-03-14 14:18:55 +01:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 09:12:13 -04:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 14:18:55 +01:00
|
|
|
*/
|
|
|
|
|
2018-09-12 20:23:39 +01: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 16:54:12 -05:00
|
|
|
if (
|
|
|
|
source &&
|
2022-09-14 18:38:03 +01:00
|
|
|
[
|
|
|
|
'consul-api-gateway',
|
|
|
|
'vault',
|
|
|
|
'kubernetes',
|
|
|
|
'terraform',
|
|
|
|
'nomad',
|
|
|
|
'consul',
|
|
|
|
'aws',
|
2022-09-20 15:34:08 +01:00
|
|
|
'lambda',
|
|
|
|
].includes(source)
|
2021-11-10 16:54:12 -05:00
|
|
|
) {
|
2018-09-12 20:23:39 +01:00
|
|
|
return `${prefix}${source}`;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default helper(serviceExternalSource);
|