Skip to content

Commit

Permalink
Merge pull request #2 from Greboh-School/feature/migration-application
Browse files Browse the repository at this point in the history
feat: refactored migrator
  • Loading branch information
Greboh authored Sep 9, 2024
2 parents f2e0650 + 6bed7c9 commit f6a7b37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public class InclusionOptions
public bool Versioning { get; set; } = true;
public bool Mapper { get; set; } = true;
public bool Cors { get; set; } = true;
public bool Migrator { get; set; } = true;
}
21 changes: 7 additions & 14 deletions School.Shared.Core/ServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,15 @@ public static int Run(string[] args)
var app = builder.Build();

entryPoint.ConfigureAppPipeline(app);

// Handle arguments making it possible to execute custom logic
switch (args.Any() ? args[0] : string.Empty)
{
case "migrate":
{
ApplyMigrations(app).Wait();
break;
}

default:
{
app.Run();
break;
}
var migratorEnabled = bool.Parse(config["Config:Inclusion:Migrator"]!);

if (migratorEnabled)
{
ApplyMigrations(app).Wait();
}

app.Run();
}
catch (Exception ex)
{
Expand Down

0 comments on commit f6a7b37

Please sign in to comment.