Skip to content

Commit 9370072

Browse files
author
Lasim
committed
refactor(backend): simplify header mapping logic for three-tier system
1 parent 05b8aff commit 9370072

File tree

1 file changed

+12
-36
lines changed

1 file changed

+12
-36
lines changed

services/backend/src/services/transforms/officialRegistryTransforms.ts

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ export function mapEnvironmentVariablesToThreeTier(
367367
* Map official headers to DeployStack's 3-tier header system
368368
*
369369
* Rules:
370-
* - Authentication headers → Team Level (shared credentials)
371-
* - Optional headers → User Level (personal customization)
370+
* - ALL headers from remotes → Team Level (shared credentials)
371+
* - Secret headers marked with type: 'secret' and appropriate visibility
372372
*
373373
* @param headers - Official headers array
374374
* @returns DeployStack ConfigurationSchema header configuration
@@ -380,41 +380,17 @@ export function mapHeadersToThreeTier(
380380
const teamHeadersSchema: TeamHeader[] = [];
381381
const userHeadersSchema: UserHeader[] = [];
382382

383+
// ALL headers from remotes go to team level
383384
for (const header of headers) {
384-
// Fixed header values go to template level
385-
if (header.value && !header.isSecret) {
386-
templateHeaders.push({
387-
name: header.name,
388-
value: header.value,
389-
locked: true,
390-
description: header.description || `Fixed header: ${header.name}`,
391-
type: 'string',
392-
required: true
393-
});
394-
continue;
395-
}
396-
397-
// Authentication headers go to team level
398-
if (header.isSecret || header.isRequired) {
399-
teamHeadersSchema.push({
400-
name: header.name,
401-
type: header.isSecret ? 'secret' : 'string',
402-
required: header.isRequired || false,
403-
description: header.description || `Header: ${header.name}`,
404-
locked: false,
405-
default_team_locked: header.isSecret || false,
406-
visible_to_users: !header.isSecret,
407-
});
408-
} else {
409-
// Optional headers go to user level
410-
userHeadersSchema.push({
411-
name: header.name,
412-
type: 'string',
413-
required: false,
414-
description: header.description || `Optional header: ${header.name}`,
415-
locked: false,
416-
});
417-
}
385+
teamHeadersSchema.push({
386+
name: header.name,
387+
type: header.isSecret ? 'secret' : 'string',
388+
required: header.isRequired || false,
389+
description: header.description || `Header: ${header.name}`,
390+
locked: false,
391+
default_team_locked: false,
392+
visible_to_users: !header.isSecret,
393+
});
418394
}
419395

420396
return { template_headers: templateHeaders, team_headers_schema: teamHeadersSchema, user_headers_schema: userHeadersSchema };

0 commit comments

Comments
 (0)