Skip to content

Feature: Add name flag to a config-manager pull commands#118

Open
brycentrivir wants to merge 1 commit into
mainfrom
feature/configManager-pullByName
Open

Feature: Add name flag to a config-manager pull commands#118
brycentrivir wants to merge 1 commit into
mainfrom
feature/configManager-pullByName

Conversation

@brycentrivir

@brycentrivir brycentrivir commented Jul 3, 2026

Copy link
Copy Markdown

A couple of commands were missing the -n, --name flag in frodo's version of config-manager, so these changes add the flag to those couple of commands

List of commands:
connector-mappings
csp
org-privileges
secrets
themes
variables

@brycentrivir
brycentrivir force-pushed the feature/configManager-pullByName branch from 741ad04 to 1572f13 Compare July 10, 2026 16:09
@brycentrivir
brycentrivir marked this pull request as ready for review July 10, 2026 16:10
@brycentrivir brycentrivir changed the title Feature: Add config-manager name flag to a couple pull commands Feature: Add name flag to a config-manager pull commands Jul 10, 2026
Comment on lines +40 to +47
let outcome: boolean;
if (options.name) {
verboseMessage(`Exporting ${options.name}`);
outcome = await configManagerExportMappings(options.name);
} else {
verboseMessage('Exporting connector mappings');
outcome = await configManagerExportMappings();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are calling the same function, you don't need an if statement here. You can simplify this to:

verboseMessage(options.name ? `Exporting ${options.name}` : 'Exporting connector mappings');
const outcome = await configManagerExportMappings(options.name);

Comment on lines +61 to +68
let outcome: boolean;
if (options.name) {
verboseMessage(`Exporting ${options.name}`);
outcome = await configManagerExportCsp(options.file, options.name);
} else {
verboseMessage('Exporting content security policy');
outcome = await configManagerExportCsp(options.file);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are calling the same function, you don't need an if statement here. You can simplify this to:

verboseMessage(options.name ? `Exporting ${options.name}` : 'Exporting content security policy');
const outcome = await configManagerExportCsp(options.file, options.name);

program
.description('Export connector mappings.')
.addOption(
new Option('-n, --name <name>', 'Export by name of connector mapping.')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: We can make the wording more concise with Export by name. or Export connector mapping by name. Technically "connector mapping" is not necessary as that is implied by the command, although it's fine if we keep it in there.

'The CSP_OVERRIDES json file. ex: "/home/trivir/Documents/csp-overrides.json", or "csp-overrides.json"'
)
)
.addOption(new Option('-n, --name <name>', 'Export by name of csp.'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'-r, --realm <realm>',
'Specifies the realm to export from. Only the entity object from this realm will be exported.'
)
new Option('-n, --name <name>', 'Export by name of org-privilege')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +23 to +24
* @param theme theme
* @param themePath theme path

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing types for these params


export async function configManagerExportThemes(): Promise<boolean> {
/**
* Exports all themes or via name / id

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are exporting by name, not by id, so remove the / id part


/**
* Export all variables to seperate files
* Export all variables to seperate files. If named param include, export only the one named variable.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would fix the grammar on this. It should be something like If name specified, export only the specified variable.

const privilegeName = 'alphaOrgPrivileges';
const CMD = `frodo config-manager pull org-privileges -D ${dirName} -n ${privilegeName}`;
await testExport(CMD, env, undefined, undefined, dirName, false);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For org-privileges, we should have a test for forgeops as well without the -n flag to ensure it will export the root realm as well as an alpha/bravo realm org privileges it has.

I would use the test configuration from here since it has configuration for the different org privileges and realms. Just make sure your forgeops tenant has an alpha and bravo realm in it before you import

"content": {
"mimeType": "application/json",
"size": 331,
"text": "{\"_id\":\"esv-goto-urls\",\"description\":\"List of valid goto urls for post login\",\"expressionType\":\"array\",\"lastChangeDate\":\"2025-02-11T20:18:49.268301Z\",\"lastChangedBy\":\"Frodo-SA-1739303176438\",\"loaded\":true,\"valueBase64\":\"WyJodHRwczovL3dlYmRldjEuaGVhbHRocGFydG5lcnMuY29tLyoiLCJodHRwczovL3dlYmRldjEuaGVhbHRocGFydG5lcnMuY29tLyo/KiJd\"}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would re-record this test using a different test ESV that you create, this ESV contains client related information

@phalestrivir

Copy link
Copy Markdown

Sorry, one more thing to check for that I noticed in the realms PR, make sure any command that does have a name option should have a name option. If the corresponding command in fr-config-manager does not have a name flag and ours does, we should delete that flag from ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants