Skip to content

Commit

Permalink
storage base migration didn't parse encryption options correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
pohhsu committed Feb 12, 2024
1 parent 2dd5b13 commit 55d80e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 14 additions & 4 deletions migrationTool/StorageOptionsBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ This is specific to the cloud you are migrating to.
description: "The key vault to store encryption keys."
);

private readonly Option<string?> _keyUri = new(
aliases: new[] { "--key-uri" },
() => "/.clearkeys?kid=${KeyId}",
description: "The key URI to use for requesting the key. This is saved to the manifest."
);

const int SegmentDurationInSeconds = 2;

public StorageOptionsBinder()
Expand Down Expand Up @@ -154,6 +160,7 @@ public Command GetCommand(string name, string description)
command.AddOption(_batchSize);
command.AddOption(_encryptContent);
command.AddOption(_keyVaultUri);
command.AddOption(_keyUri);
return command;
}

Expand All @@ -175,10 +182,13 @@ protected override StorageOptions GetBoundValue(BindingContext bindingContext)
bindingContext.ParseResult.GetValueForOption(_breakOutputLease),
bindingContext.ParseResult.GetValueForOption(_keepWorkingFolder),
SegmentDurationInSeconds,
bindingContext.ParseResult.GetValueForOption(_batchSize),
bindingContext.ParseResult.GetValueForOption(_encryptContent),
bindingContext.ParseResult.GetValueForOption(_keyVaultUri)
);
bindingContext.ParseResult.GetValueForOption(_batchSize)
)
{
EncryptContent = bindingContext.ParseResult.GetValueForOption(_encryptContent),
KeyUri = bindingContext.ParseResult.GetValueForOption(_keyUri),
KeyVaultUri = bindingContext.ParseResult.GetValueForOption(_keyVaultUri)
};
}

public StorageOptions GetValue(BindingContext bindingContext) => GetBoundValue(bindingContext);
Expand Down
4 changes: 1 addition & 3 deletions migrationTool/contracts/StorageOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public record StorageOptions(
bool BreakOutputLease,
bool KeepWorkingFolder,
int SegmentDuration,
int BatchSize,
bool _encryptContent,
Uri? _keyVaultUri)
int BatchSize)
: MigratorOptions(
AccountName,
StoragePath,
Expand Down

0 comments on commit 55d80e9

Please sign in to comment.