Skip to content

Commit

Permalink
Update from reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Nov 6, 2024
1 parent 5e61336 commit 0b418c3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static IMachineBuilder AddUnigramTruecaser(this IMachineBuilder builder)

public static IMachineBuilder AddClearMLService(this IMachineBuilder builder, string? connectionString = null)
{
connectionString ??= builder.Configuration?.GetConnectionString("ClearML");
connectionString ??= builder.Configuration.GetConnectionString("ClearML");
if (connectionString is null)
throw new InvalidOperationException("ClearML connection string is required");

Expand Down Expand Up @@ -145,7 +145,7 @@ public static IMachineBuilder AddMongoHangfireJobClient(
string? connectionString = null
)
{
connectionString ??= builder.Configuration?.GetConnectionString("Hangfire");
connectionString ??= builder.Configuration.GetConnectionString("Hangfire");
if (connectionString is null)
throw new InvalidOperationException("Hangfire connection string is required");

Expand All @@ -166,7 +166,7 @@ public static IMachineBuilder AddHangfireJobServer(
)
{
engineTypes ??=
builder.Configuration?.GetSection("TranslationEngines").Get<TranslationEngineType[]?>()
builder.Configuration.GetSection("TranslationEngines").Get<TranslationEngineType[]?>()
?? [TranslationEngineType.SmtTransfer, TranslationEngineType.Nmt];
var queues = new List<string>();
foreach (TranslationEngineType engineType in engineTypes.Distinct())
Expand Down Expand Up @@ -207,7 +207,7 @@ public static IMachineBuilder AddMemoryDataAccess(this IMachineBuilder builder)

public static IMachineBuilder AddMongoDataAccess(this IMachineBuilder builder, string? connectionString = null)
{
connectionString ??= builder.Configuration?.GetConnectionString("Mongo");
connectionString ??= builder.Configuration.GetConnectionString("Mongo");
if (connectionString is null)
throw new InvalidOperationException("Mongo connection string is required");
builder.Services.AddMongoDataAccess(
Expand Down Expand Up @@ -262,7 +262,7 @@ public static IMachineBuilder AddServalPlatformService(
string? connectionString = null
)
{
connectionString ??= builder.Configuration?.GetConnectionString("Serval");
connectionString ??= builder.Configuration.GetConnectionString("Serval");
if (connectionString is null)
throw new InvalidOperationException("Serval connection string is required");

Expand Down Expand Up @@ -329,7 +329,7 @@ public static IMachineBuilder AddServalTranslationEngineService(
builder.AddServalPlatformService(connectionString);

engineTypes ??=
builder.Configuration?.GetSection("TranslationEngines").Get<TranslationEngineType[]?>()
builder.Configuration.GetSection("TranslationEngines").Get<TranslationEngineType[]?>()
?? [TranslationEngineType.SmtTransfer, TranslationEngineType.Nmt];
foreach (TranslationEngineType engineType in engineTypes.Distinct())
{
Expand Down Expand Up @@ -368,7 +368,7 @@ public static IMachineBuilder AddBuildJobService(this IMachineBuilder builder, s
if (smtTransferEngineDir is null)
{
var smtTransferEngineOptions = new SmtTransferEngineOptions();
builder.Configuration?.GetSection(SmtTransferEngineOptions.Key).Bind(smtTransferEngineOptions);
builder.Configuration.GetSection(SmtTransferEngineOptions.Key).Bind(smtTransferEngineOptions);
smtTransferEngineDir = smtTransferEngineOptions.EnginesDir;
}
string? driveLetter = Path.GetPathRoot(smtTransferEngineDir)?[..1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static IServalBuilder AddAssessment(this IServalBuilder builder)
builder.Services.AddScoped<IEngineService, EngineService>();

var assessmentOptions = new AssessmentOptions();
builder.Configuration?.GetSection(AssessmentOptions.Key).Bind(assessmentOptions);
builder.Configuration.GetSection(AssessmentOptions.Key).Bind(assessmentOptions);

foreach (EngineInfo engine in assessmentOptions.Engines)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static IServalBuilder AddMongoDataAccess(
Action<IMongoDataAccessConfigurator> configure
)
{
string? mongoConnectionString = builder.Configuration?.GetConnectionString("Mongo");
string? mongoConnectionString = builder.Configuration.GetConnectionString("Mongo");
if (mongoConnectionString is null)
throw new InvalidOperationException("Mongo connection string not configured");
builder.Services.AddMongoDataAccess(mongoConnectionString, "Serval", configure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static IServalBuilder AddTranslation(this IServalBuilder builder)
builder.Services.AddScoped<IEngineService, EngineService>();

var translationOptions = new TranslationOptions();
builder.Configuration?.GetSection(TranslationOptions.Key).Bind(translationOptions);
builder.Configuration.GetSection(TranslationOptions.Key).Bind(translationOptions);

foreach (EngineInfo engine in translationOptions.Engines)
{
Expand Down

0 comments on commit 0b418c3

Please sign in to comment.