mirror of https://github.com/hashicorp/consul
45 lines
1.6 KiB
Plaintext
45 lines
1.6 KiB
Plaintext
|
${
|
||
|
[1].map(() => {
|
||
|
const type = `${fake.helpers.randomize(['kubernetes', 'jwt', 'oidc'])}`;
|
||
|
const fakeIP = `${fake.internet.ip()}`;
|
||
|
let config = {};
|
||
|
switch(type) {
|
||
|
case 'kubernetes':
|
||
|
config = {
|
||
|
Host: `https://${fake.internet.ip()}:8443`,
|
||
|
CACert: `-----BEGIN CERTIFICATE-----${fake.internet.password(1357)}-----END CERTIFICATE-----`,
|
||
|
ServiceAccountJWT: `eyJhbGciOiJ${fake.internet.password(25)}.eyJ${fake.internet.password(61)}.${fake.internet.password(32)}`
|
||
|
};
|
||
|
break;
|
||
|
case 'oidc':
|
||
|
config = {
|
||
|
OIDCDiscoveryURL: `https://${fake.internet.ip()}:8443`,
|
||
|
};
|
||
|
break;
|
||
|
case 'jwt':
|
||
|
config = {
|
||
|
JWTValidationPubKeys: `-----BEGIN CERTIFICATE-----${fake.internet.password(1357)}-----END CERTIFICATE-----`,
|
||
|
JWKSURL: `https://${fake.internet.ip()}:8443`,
|
||
|
OIDCDiscoveryURL: `https://${fake.internet.ip()}:8443`,
|
||
|
};
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
return `{
|
||
|
"Name": "${location.pathname.get(3)}",
|
||
|
"Namespace": "${
|
||
|
typeof location.search.ns !== 'undefined' ? location.search.ns :
|
||
|
typeof http.body.Namespace !== 'undefined' ? http.body.Namespace : 'default'
|
||
|
}",
|
||
|
"Type": "${type}",
|
||
|
"Description": "${fake.lorem.sentence()}",
|
||
|
"DisplayName": "${fake.hacker.noun()}",
|
||
|
"MaxTokenTTL": "${fake.random.number({min: 0, max: 60})}m${fake.random.number({min: 0, max: 60})}s",
|
||
|
"TokenLocality": "${fake.helpers.randomize(['local', 'global', ''])}",
|
||
|
"Config": ${JSON.stringify(config)},
|
||
|
"CreateIndex": ${fake.random.number()},
|
||
|
"ModifyIndex": 10
|
||
|
}`
|
||
|
})
|
||
|
}
|