Skip to content

ProfileManager

Manage profile storage and retrieval.


Getting Instance

import { getProfileManager } from '@robinmordasiewicz/f5xc-auth';

const profileManager = getProfileManager();

Methods

list(): Promise<string[]>

List all available profile names.

const profiles = await profileManager.list();
// Returns: ['production', 'staging', 'development']

load(name: string): Promise<Profile | null>

Load a specific profile.

const profile = await profileManager.load('production');
if (profile) {
  console.log('Loaded profile:', profile.name);
}

save(profile: Profile): Promise<void>

Save a new or updated profile.

await profileManager.save({
  name: 'production',
  apiUrl: 'https://mytenant.console.ves.volterra.io',
  apiToken: 'token',
  defaultNamespace: 'my-ns'
});

delete(name: string): Promise<void>

Delete a specific profile.

await profileManager.delete('old-profile');

getActiveProfile(): Promise<Profile | null>

Get the currently active profile.

const active = await profileManager.getActiveProfile();
console.log('Active:', active?.name);

setActive(name: string): Promise<void>

Set a profile as active.

await profileManager.setActive('production');

deleteActive(): Promise<void>

Delete the active profile marker.

await profileManager.deleteActive();

isActive(name: string): Promise<boolean>

Check if a specific profile is active.

const isActive = await profileManager.isActive('production');

See Also