Skip to content

Commit

Permalink
修复 EnvAccessor 读取 env 的 bug;
Browse files Browse the repository at this point in the history
  • Loading branch information
agile.zhou committed Dec 23, 2023
1 parent 17bda7d commit 01ab14a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/AgileConfig.Server.Common/EnvAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ public interface IEnvAccessor

public class EnvAccessor : IEnvAccessor
{
private IHttpContextAccessor _httpContextAccessor;
public EnvAccessor(IHttpContextAccessor httpContextAccessor)
{
var env = httpContextAccessor.HttpContext.Request.Query["env"].FirstOrDefault();
if (string.IsNullOrEmpty(env))
_httpContextAccessor = httpContextAccessor;
}
public string Env
{
get
{
env = "DEV";
var env = _httpContextAccessor.HttpContext.Request.Query["env"].FirstOrDefault();
if (string.IsNullOrEmpty(env))
{
env = "DEV";
}
return env;
}
Env = env;
}
public string Env { get; }
}

public static class EnvAccessorServiceCollectionExtension
Expand Down

0 comments on commit 01ab14a

Please sign in to comment.