Skip to content

Commit

Permalink
Price url was not set, causing a null reference exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mivano committed Jan 1, 2025
1 parent 4c5b663 commit f776447
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Commands/WhatIf/DevTestWhatIfCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public override async Task<int> ExecuteAsync(CommandContext context, WhatIfSetti
{
// Get the subscription ID from the settings
var subscriptionId = settings.Subscription;
_costRetriever.CostApiAddress = settings.CostApiAddress;
_priceRetriever.PriceApiAddress = settings.PriceApiAddress;

if (subscriptionId.HasValue == false && (settings.GetScope.IsSubscriptionBased))
{
Expand Down
1 change: 1 addition & 0 deletions src/Commands/WhatIf/RegionWhatIfCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public RegionWhatIfCommand(IPriceRetriever priceRetriever, ICostRetriever costRe
public override async Task<int> ExecuteAsync(CommandContext context, WhatIfSettings settings)
{
_costRetriever.CostApiAddress = settings.CostApiAddress;
_priceRetriever.PriceApiAddress = settings.PriceApiAddress;

// Get the subscription ID from the settings
var subscriptionId = settings.Subscription;
Expand Down
4 changes: 4 additions & 0 deletions src/Commands/WhatIf/WhatIfSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public class WhatIfSettings : CommandSettings, ICostSettings //:CostSettings
[Description("The base address for the Cost API. Defaults to https://management.azure.com/")]
public string CostApiAddress { get; set; } = "https://management.azure.com/";

[CommandOption("--priceApiBaseAddress <BASE_ADDRESS>")]
[Description("The base address for the Price API. Defaults to https://prices.azure.com/")]
public string PriceApiAddress { get; set; } = "https://prices.azure.com/";

public Scope GetScope
{
get {
Expand Down

0 comments on commit f776447

Please sign in to comment.