Skip to content

Commit

Permalink
隐藏敏感信息
Browse files Browse the repository at this point in the history
  • Loading branch information
SpringHgui committed Jul 14, 2024
1 parent aea49e9 commit f37696f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
using Microsoft.Extensions.Logging;
using OpenTask.Persistence.Contexts;
using OpenTask.Persistence.Models;
using Org.BouncyCastle.Security;
using System.Reflection;
using System.Runtime.Loader;
using System.Text.RegularExpressions;

namespace OpenTask.Persistence.Extensions
{
Expand All @@ -25,8 +27,12 @@ public static IServiceCollection AddDefalutPersistence(this IServiceCollection s
var logger = loggerFactory.CreateLogger("PersistenceCollectionExtensions");

string? constr = configuration["ConnectionStrings:Core"];
if (constr == null)
{
throw new InvalidParameterException("未配置数据库连接字符串");
}

logger.LogInformation(constr);
logger.LogInformation($"db: {Regex.Replace(constr, @"(?<=password=).*?(?=;|$)", "******")}");

_ = services.AddDapperdbContext<DapperdbContext>(options =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTask.WebApi/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ConnectionStrings__Core": "server=localhost;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_!@#"
//"ConnectionStrings__Core": "server=127.0.0.1;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_!@#"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7254;http://localhost:5223"
Expand Down

0 comments on commit f37696f

Please sign in to comment.