fix(striker-ui-api): correct config to job data, allow flexible org name in config striker

main
Tsu-ba-me 2 years ago
parent f7918d7d6c
commit 2db17c9d1b
  1. 24
      striker-ui-api/src/lib/request_handlers/host/configStriker.ts

@ -79,8 +79,8 @@ const configToJobData = (
entries: [keyof FormConfigData, FormConfigData[keyof FormConfigData]][],
) =>
entries
.reduce<string>((previous, [key, value]) => {
previous += `${key}=${value}\n`;
.reduce<string>((previous, [key, { value }]) => {
previous += `${key}=${value}\\n`;
return previous;
}, '')
@ -96,16 +96,16 @@ export const configStriker: RequestHandler<
stdoutVar(body, 'Begin initialize Striker; body=');
const {
adminPassword: rAdminPassword = '',
domainName: rDomainName = '',
hostName: rHostName = '',
hostNumber: rHostNumber = 0,
dns: rDns = '',
gateway: rGateway = '',
gatewayInterface: rGatewayInterface = '',
adminPassword: rAdminPassword,
domainName: rDomainName,
hostName: rHostName,
hostNumber: rHostNumber,
dns: rDns,
gateway: rGateway,
gatewayInterface: rGatewayInterface,
networks = [],
organizationName: rOrganizationName = '',
organizationPrefix: rOrganizationPrefix = '',
organizationName: rOrganizationName,
organizationPrefix: rOrganizationPrefix,
} = body;
const adminPassword = sanitize(rAdminPassword, 'string');
@ -155,7 +155,7 @@ export const configStriker: RequestHandler<
);
assert(
REP_PEACEFUL_STRING.test(organizationName),
organizationName.length > 0,
`Data organization name cannot be empty; got [${organizationName}]`,
);

Loading…
Cancel
Save