Skip to content

Commit

Permalink
Handle no-environment containers in PrepareCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
enisn committed Jan 21, 2025
1 parent 82637b9 commit b6497a6
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/AbpDevTools/Commands/PrepareCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,26 @@ await AnsiConsole.Status()
}
else
{
var environmentName = environmentNames.First();
var localConfig = new LocalConfiguration
var environmentName = environmentNames.FirstOrDefault();
if (!string.IsNullOrEmpty(environmentName))
{
Environment = new LocalConfiguration.LocalEnvironmentOption
{
Name = environmentName,
}
};
var localConfig = new LocalConfiguration
{
Environment = new LocalConfiguration.LocalEnvironmentOption
{
Name = environmentName,
}
};

var filePath = LocalConfigurationManager.Save(WorkingDirectory, localConfig);
AnsiConsole.WriteLine($"{Emoji.Known.Memo} Created local configuration for environment {environmentName}: {Path.GetRelativePath(WorkingDirectory, filePath)}");
var filePath = LocalConfigurationManager.Save(WorkingDirectory, localConfig);
AnsiConsole.WriteLine($"{Emoji.Known.Memo} Created local configuration for environment {environmentName}: {Path.GetRelativePath(WorkingDirectory, filePath)}");
AnsiConsole.WriteLine($"{Emoji.Known.Memo} You can skip creating local configuration file with '--no-config' option.");
}
else
{
AnsiConsole.WriteLine($"{Emoji.Known.Information } No environment name found for the project. Skipping creating local configuration file (abpdev.yml).");
}
}
AnsiConsole.WriteLine($"{Emoji.Known.Memo} You can skip creating local configuration file with '--no-config' option.");
}

EnvironmentAppStartCommand.AppNames = environmentApps.Select(x => x.AppName).ToArray();
Expand Down

0 comments on commit b6497a6

Please sign in to comment.