diff --git a/src/commands/common.ts b/src/commands/common.ts index 58ebc226..1df93bea 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -10,6 +10,7 @@ import { logger, registerLogger } from '../log.js'; import { isArgo } from '../utils/argo.js'; export const config = option({ + defaultValue: () => process.env['AWS_ROLE_CONFIG_PATH'], long: 'config', description: 'Location of role configuration file', type: optional(string), @@ -31,7 +32,7 @@ export const forceOutput = flag({ export function registerCli(cli: { name: string }, args: { verbose?: boolean; config?: string }): void { cleanArgs(args); registerLogger(args); - registerFileSystem(args); + registerFileSystem(args.config); logger.info({ package: CliInfo, cli: cli.name, args, isArgo: isArgo() }, 'Cli:Start'); } diff --git a/src/fs.register.ts b/src/fs.register.ts index 662f4555..570555cd 100644 --- a/src/fs.register.ts +++ b/src/fs.register.ts @@ -18,13 +18,12 @@ function splitConfig(x: string): string[] { return x.split(','); } -export function registerFileSystem(opts: { config?: string }): void { +export function registerFileSystem(config?: string): void { fsa.register('s3://', s3Fs); - const configPath = opts.config ?? process.env['AWS_ROLE_CONFIG_PATH']; - if (configPath == null || configPath === '') return; + if (config == null || config === '') return; - const paths = splitConfig(configPath); + const paths = splitConfig(config); for (const path of paths) s3Fs.credentials.registerConfig(path, fsa); }