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

Loading…
Cancel
Save