Skip to content

yarp用EFCore存储配置,可视化面板配置,支持热更新

License

Notifications You must be signed in to change notification settings

fanslead/ReverseProxy.Store

Repository files navigation

ReverseProxy.Store

image image image image image

先看界面

1639733073(1) image

yarp用EFCore存储配置 安裝

Install-Package ReverseProxy.Store.EFCore -Version 2.0.0

或者

dotnet add package ReverseProxy.Store.EFCore --version 2.0.0

分布式同步配置更新 安裝

Install-Package ReverseProxy.Store.Distributed -Version 2.0.0

或者

dotnet add package ReverseProxy.Store.Distributed --version 2.0.0

使用界面

使用说明

先配置数据库链接字符串,然后执行code first还原数据库,然后就可以用了。

appsettings.json加上下面东西,Password是前端登录验证密码(做做样子的233333)

  "ConnectionStrings": {
    "Default": ""
  },
    "Password": "password"

使用ReverseProxy.WebApi

配置

using ReverseProxy.Store.EFCore;
using ReverseProxy.Store.EFCore.Management;
public void ConfigureServices(IServiceCollection services)
{
    services.AddMemoryCache();
    services.AddDbContext<EFCoreDbContext>(options =>
                    options.UseMySql(
                        Configuration.GetConnectionString("Default"),
                        ServerVersion.AutoDetect(Configuration.GetConnectionString("Default")),
                        b => b.MigrationsAssembly("EFCoreSample")));
    services.AddTransient<IClusterManagement, ClusterManagement>();
    services.AddTransient<IProxyRouteManagement, ProxyRouteManagement>();
    services.AddReverseProxy()
            .LoadFromEFCore()
             //.AddRedis("127.0.0.1:6379"); //使用redis同步配置更新
}

然后就可以自己实现业务API管理配置内容啦~~~

启动ReverseProxy.Dashboard

修改public目录下的config.js可以配置请求后端路径,默认如下

const orign = 'http://localhost:5201'
const apiConfig = {
  baseURL: orign
};