File tree Expand file tree Collapse file tree
packages/b2c-tooling-sdk/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,13 +220,17 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
220220 * - `pluginSourcesAfter`: Low priority sources (fill gaps)
221221 */
222222 protected async collectPluginConfigSources ( ) : Promise < void > {
223+ // Access flags that may be defined in subclasses (OAuthCommand, InstanceCommand)
224+ const flags = this . flags as Record < string , unknown > ;
225+
223226 const hookOptions : ConfigSourcesHookOptions = {
224227 instance : this . flags . instance ,
225228 configPath : this . flags . config ,
226- flags : this . flags as Record < string , unknown > ,
229+ flags,
227230 resolveOptions : {
228231 instance : this . flags . instance ,
229232 configPath : this . flags . config ,
233+ accountManagerHost : flags [ 'account-manager-host' ] as string | undefined ,
230234 } ,
231235 } ;
232236
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ export interface LoadConfigOptions {
3434 cloudOrigin ?: string ;
3535 /** Path to custom MRT credentials file (overrides default ~/.mobify) */
3636 credentialsFile ?: string ;
37+ /** Account Manager hostname for OAuth (passed to plugins for host-specific config) */
38+ accountManagerHost ?: string ;
3739}
3840
3941/**
@@ -100,6 +102,7 @@ export function loadConfig(
100102 hostnameProtection : true ,
101103 cloudOrigin : options . cloudOrigin ,
102104 credentialsFile : options . credentialsFile ,
105+ accountManagerHost : options . accountManagerHost ,
103106 sourcesBefore : pluginSources . before ,
104107 sourcesAfter : pluginSources . after ,
105108 } ) ;
Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ export interface DwJsonConfig {
5353 'secure-server' ?: string ;
5454 /** Allowed authentication methods in priority order */
5555 'auth-methods' ?: AuthMethod [ ] ;
56+ /** Account Manager hostname for OAuth */
57+ 'account-manager-host' ?: string ;
5658 /** MRT project slug */
5759 mrtProject ?: string ;
5860 /** MRT environment name (e.g., staging, production) */
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export function mapDwJsonToNormalizedConfig(json: DwJsonConfig): NormalizedConfi
5151 shortCode : json . shortCode || json [ 'short-code' ] || json [ 'scapi-shortcode' ] ,
5252 instanceName : json . name ,
5353 authMethods : json [ 'auth-methods' ] ,
54+ accountManagerHost : json [ 'account-manager-host' ] ,
5455 mrtProject : json . mrtProject ,
5556 mrtEnvironment : json . mrtEnvironment ,
5657 } ;
Original file line number Diff line number Diff line change @@ -154,10 +154,15 @@ export class ConfigResolver {
154154 const sourceInfos : ConfigSourceInfo [ ] = [ ] ;
155155 const baseConfig : NormalizedConfig = { } ;
156156
157+ // Create enriched options that will be updated with accumulated config values.
158+ // This allows later sources (like plugins) to use values discovered by earlier sources (like dw.json).
159+ // CLI-provided options always take precedence over accumulated values.
160+ const enrichedOptions : ResolveConfigOptions = { ...options } ;
161+
157162 // Load from each source in order, merging results
158163 // Earlier sources have higher priority - later sources only fill in missing values
159164 for ( const source of this . sources ) {
160- const result = source . load ( options ) ;
165+ const result = source . load ( enrichedOptions ) ;
161166 if ( result ) {
162167 const { config : sourceConfig , location} = result ;
163168 const fields = getPopulatedFields ( sourceConfig ) ;
@@ -197,6 +202,12 @@ export class ConfigResolver {
197202 fields,
198203 fieldsIgnored : fieldsIgnored . length > 0 ? fieldsIgnored : undefined ,
199204 } ) ;
205+
206+ // Enrich options with accumulated config values for subsequent sources.
207+ // Only set if not already provided via CLI options.
208+ if ( ! enrichedOptions . accountManagerHost && baseConfig . accountManagerHost ) {
209+ enrichedOptions . accountManagerHost = baseConfig . accountManagerHost ;
210+ }
200211 }
201212 }
202213 }
Original file line number Diff line number Diff line change @@ -127,6 +127,8 @@ export interface ResolveConfigOptions {
127127 cloudOrigin ?: string ;
128128 /** Path to custom MRT credentials file (overrides default ~/.mobify) */
129129 credentialsFile ?: string ;
130+ /** Account Manager hostname for OAuth (passed to plugins for host-specific config) */
131+ accountManagerHost ?: string ;
130132
131133 /**
132134 * Custom sources to add BEFORE default sources (higher priority).
You can’t perform that action at this time.
0 commit comments