2020-11-05 16:03:49 +00:00
|
|
|
${ env('CONSUL_ACLS_LEGACY', false) ? `rpc error making call: rpc: can't find method ACL.Method` : `
|
|
|
|
[
|
|
|
|
${
|
|
|
|
range(
|
|
|
|
env(
|
|
|
|
'CONSUL_TOKEN_COUNT',
|
|
|
|
Math.floor(
|
|
|
|
(
|
|
|
|
Math.random() * env('CONSUL_TOKEN_MAX', 10)
|
|
|
|
) + parseInt(env('CONSUL_TOKEN_MIN', 1))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
).map(
|
|
|
|
function(item, i) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"AccessorID": "${i === 1 ? '00000000-0000-0000-0000-000000000002' : fake.random.uuid()}",
|
2021-07-30 17:52:37 +00:00
|
|
|
"SecretID": "${fake.helpers.randomize([fake.random.uuid(), '<hidden>', ''])}",
|
2020-11-05 16:03:49 +00:00
|
|
|
"Name": "token-${i}",
|
|
|
|
${typeof location.search.ns !== 'undefined' ? `
|
|
|
|
"Namespace": "${location.search.ns}",
|
2021-09-15 18:50:11 +00:00
|
|
|
` : ``}
|
|
|
|
${typeof location.search.partition !== 'undefined' ? `
|
|
|
|
"Partition": "${location.search.partition}",
|
2020-11-05 16:03:49 +00:00
|
|
|
` : ``}
|
|
|
|
"IDPName": "${fake.hacker.noun()}",
|
|
|
|
"Policies": [
|
|
|
|
${
|
2021-07-30 17:52:37 +00:00
|
|
|
range(env('CONSUL_POLICY_COUNT', 3)).map(
|
2020-11-05 16:03:49 +00:00
|
|
|
function(item, j) {
|
|
|
|
if(i == 1 && j == 0) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ID": "00000000-0000-0000-0000-000000000001",
|
|
|
|
"Name": "global-management"
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ID": "${fake.random.uuid()}",
|
|
|
|
"Name": "${fake.hacker.noun()}"
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"Roles": [
|
|
|
|
${
|
2021-07-30 17:52:37 +00:00
|
|
|
range(env('CONSUL_ROLE_COUNT', 3)).map(
|
2020-11-05 16:03:49 +00:00
|
|
|
function(item, j) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ID": "${fake.random.uuid()}",
|
|
|
|
"Name": "${fake.hacker.noun()}"
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"ServiceIdentities": [
|
|
|
|
${
|
|
|
|
range(env('CONSUL_SERVICE_IDENTITY_COUNT', env('CONSUL_IDENTITY_COUNT', 1))).map(
|
|
|
|
function(item, i) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"ServiceName": "${fake.hacker.noun()}"${ fake.random.boolean() ? `,
|
|
|
|
"Datacenters": [
|
|
|
|
${
|
|
|
|
range(env('CONSUL_DATACENTER_COUNT', fake.random.number({min: 1, max: 10}))).map(
|
|
|
|
function(item, i) {
|
|
|
|
return `"${fake.address.countryCode().toLowerCase()} ${ i % 2 ? "west" : "east"}-${i}"`;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
` : ``}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"NodeIdentities": [
|
|
|
|
${
|
|
|
|
range(env('CONSUL_NODE_IDENTITY_COUNT', 1)).map(
|
|
|
|
function(item, i) {
|
|
|
|
return `
|
|
|
|
{
|
|
|
|
"NodeName": "${fake.hacker.noun()}",
|
|
|
|
"Datacenter":"${fake.address.countryCode().toLowerCase()} ${ i % 2 ? "west" : "east"}-${i}"
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
${ fake.random.boolean() && i !== 1 ? '"Legacy": true,' : "" }
|
|
|
|
${ fake.random.boolean() ? '"Local": true,' : "" }
|
|
|
|
"CreateTime": "${fake.date.past(10).toISOString()}",
|
|
|
|
"Hash": "${fake.internet.password(64)}=",
|
|
|
|
"CreateIndex": 10,
|
|
|
|
"ModifyIndex": 10
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
`}
|