Skip to content

Commit

Permalink
revert: "refactor: Move default value up the stack TDE-1030 (#854)" (#…
Browse files Browse the repository at this point in the history
…867)

This reverts commit 18576e6 which
caused issues when copying files due to `registerCli` being invoked in
multiple places.
  • Loading branch information
amfage authored Feb 16, 2024
1 parent 4fa0b2e commit bd2c505
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/commands/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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),
Expand All @@ -32,7 +31,7 @@ export const forceOutput = flag({
export function registerCli(cli: { name: string }, args: { verbose?: boolean; config?: string }): void {
cleanArgs(args);
registerLogger(args);
registerFileSystem(args.config);
registerFileSystem(args);

logger.info({ package: CliInfo, cli: cli.name, args, isArgo: isArgo() }, 'Cli:Start');
}
Expand Down
7 changes: 4 additions & 3 deletions src/fs.register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ function splitConfig(x: string): string[] {
return x.split(',');
}

export function registerFileSystem(config?: string): void {
export function registerFileSystem(opts: { config?: string }): void {
fsa.register('s3://', s3Fs);

if (config == null || config === '') return;
const configPath = opts.config ?? process.env['AWS_ROLE_CONFIG_PATH'];
if (configPath == null || configPath === '') return;

const paths = splitConfig(config);
const paths = splitConfig(configPath);

for (const path of paths) s3Fs.credentials.registerConfig(path, fsa);
}

0 comments on commit bd2c505

Please sign in to comment.