Skip to content

Commit

Permalink
fix(cli): Need to set AwsRoleConfigPath for RoleRegister (#2427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentao-Kuang committed Aug 11, 2022
1 parent 2cbfb40 commit cd564b1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/cli/src/cli/config/action.imagery.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { Config, ConfigProviderMemory } from '@basemaps/config';
import { Nztm2000QuadTms, Bounds } from '@basemaps/geo';
import { ulid } from 'ulid';
import { CommandLineAction, CommandLineFlagParameter, CommandLineStringParameter } from '@rushstack/ts-command-line';
import { fsa, LogConfig, RoleRegister } from '@basemaps/shared';
import { Env, fsa, LogConfig, RoleRegister } from '@basemaps/shared';

export class CommandImageryConfig extends CommandLineAction {
private path: CommandLineStringParameter;
private config: CommandLineStringParameter;
private commit: CommandLineFlagParameter;

public constructor() {
Expand All @@ -24,6 +25,11 @@ export class CommandImageryConfig extends CommandLineAction {
description: 'Path of raw imagery, this can be both a local path or s3 location',
required: true,
});
this.config = this.defineStringParameter({
argumentName: 'CONFIG',
parameterLongName: '--config',
description: 'Location of a configuration file containing role->bucket mapping information',
});
this.commit = this.defineFlagParameter({
parameterLongName: '--commit',
description: 'Actually upload the config to s3.',
Expand All @@ -38,6 +44,11 @@ export class CommandImageryConfig extends CommandLineAction {
if (!path.endsWith('/')) path += '/';
const commit = this.commit.value ?? false;

const config = this.config.value;
if (config) {
logger.info({ path: config }, 'Role:Config');
process.env[Env.AwsRoleConfigPath] = config;
}
const assumedRole = await RoleRegister.findRole(path);
if (assumedRole) logger.debug({ path, roleArn: assumedRole?.roleArn }, 'ImageryConfig:AssumeRole');

Expand Down

0 comments on commit cd564b1

Please sign in to comment.