Skip to content

Commit

Permalink
Merge pull request #126 from IzyPro/v1.4.10
Browse files Browse the repository at this point in the history
- Security Optimization
  • Loading branch information
Khelechy authored May 19, 2023
2 parents af2d70b + 69c9a84 commit 4b42d1a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ It leverages `SignalR` for real-time monitoring and `LiteDb` a Serverless MongoD
Install via .NET CLI

```bash
dotnet add package WatchDog.NET --version 1.4.9
dotnet add package WatchDog.NET --version 1.4.10
```
Install via Package Manager

```bash
Install-Package WatchDog.NET --version 1.4.9
Install-Package WatchDog.NET --version 1.4.10
```


Expand Down
2 changes: 1 addition & 1 deletion WatchDog/WatchDog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Authors>Israel Ulelu, Kelechi Onyekwere</Authors>
<PackageId>WatchDog.NET</PackageId>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.4.9</Version>
<Version>1.4.10</Version>
<PackageReleaseNotes>- Security Optimization
- Query Filters Fixes and Optimizations
- Package Assembly as DB Name Fix(MongoDB)</PackageReleaseNotes>
Expand Down
5 changes: 2 additions & 3 deletions WatchDog/WatchDogExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public static class WatchDogExtension

public static IServiceCollection AddWatchDogServices(this IServiceCollection services, [Optional] Action<WatchDogSettings> configureOptions)
{
string mongoDbName = Assembly.GetCallingAssembly().GetName().Name.Replace('.', '_') + "_WatchDogDB";
var options = new WatchDogSettings();
if (configureOptions != null)
configureOptions(options);
Expand All @@ -35,7 +34,7 @@ public static IServiceCollection AddWatchDogServices(this IServiceCollection ser
AutoClearModel.ClearTimeSchedule = options.ClearTimeSchedule;
WatchDogExternalDbConfig.ConnectionString = options.SetExternalDbConnString;
WatchDogDatabaseDriverOption.DatabaseDriverOption = options.DbDriverOption;
WatchDogExternalDbConfig.MongoDbName = mongoDbName;
WatchDogExternalDbConfig.MongoDbName = Assembly.GetCallingAssembly().GetName().Name?.Replace('.', '_') + "_WatchDogDB";

if (!string.IsNullOrEmpty(WatchDogExternalDbConfig.ConnectionString) && WatchDogDatabaseDriverOption.DatabaseDriverOption == 0)
throw new WatchDogDBDriverException("Missing DB Driver Option: DbDriverOption is required at .AddWatchDogServices()");
Expand Down Expand Up @@ -64,7 +63,7 @@ public static IServiceCollection AddWatchDogServices(this IServiceCollection ser
{
if (WatchDogDatabaseDriverOption.DatabaseDriverOption == src.Enums.WatchDogDbDriverEnum.Mongo)
{
ExternalDbContext.MigrateNoSql(mongoDbName);
ExternalDbContext.MigrateNoSql();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions WatchDog/src/Data/ExternalDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public static void BootstrapTables()

}

public static void MigrateNoSql(string databaseName)
public static void MigrateNoSql()
{
try
{
var mongoClient = CreateMongoDBConnection();
var database = mongoClient.GetDatabase(databaseName);
var database = mongoClient.GetDatabase(WatchDogExternalDbConfig.MongoDbName);
_ = database.GetCollection<WatchLog>(Constants.WatchLogTableName);
_ = database.GetCollection<WatchExceptionLog>(Constants.WatchLogExceptionTableName);
_ = database.GetCollection<WatchLoggerModel>(Constants.LogsTableName);
Expand Down
2 changes: 1 addition & 1 deletion WatchDog/src/Models/WatchDogConfigModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class WatchDogSettings
public static class WatchDogExternalDbConfig
{
public static string ConnectionString { get; set; } = string.Empty;
public static string MongoDbName { get; set; } = string.Empty;
public static string MongoDbName { get; set; } = "WatchDogDb";
}

public static class WatchDogDatabaseDriverOption
Expand Down

0 comments on commit 4b42d1a

Please sign in to comment.