Browse Source

update

集成Redis
wanggang 2 years ago
parent
commit
7400451ac4
  1. 9
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Program.cs
  2. 3
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj
  3. 20
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/appsettings.json
  4. 6
      be/Modules/Shared/src/Win_in.Sfs.Shared.Host/HostBuilderExtensions.cs
  5. 7
      build/src/docker/publish/conf/gateway/Caddyfile
  6. 7
      build/src/docker/publish/conf/gateway/Caddyfile.dev

9
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Program.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Win_in.Sfs.Shared.Host; using Win_in.Sfs.Shared.Host;
namespace Win_in.Sfs.Auth.Web; namespace Win_in.Sfs.Auth.Web;
@ -7,6 +8,12 @@ public class Program
{ {
public static int Main(string[] args) public static int Main(string[] args)
{ {
return WebApplication.CreateBuilder(args).BuildAndRun<AuthWebModule>(); return WebApplication.CreateBuilder(args).BuildAndRun<AuthWebModule>(o =>
{
o.Services.AddReverseProxy().LoadFromConfig(o.Configuration.GetSection("ReverseProxy"));
}, o =>
{
o.MapReverseProxy();
});
} }
} }

3
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj

@ -14,7 +14,7 @@
<PreserveCompilationReferences>true</PreserveCompilationReferences> <PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Auth-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> <UserSecretsId>Win_in.Sfs.Auth-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild> <IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.324.1723</Version> <Version>1.2023.324.1857</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
@ -32,6 +32,7 @@
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="5.3.5" /> <PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="5.3.5" />
<PackageReference Include="Volo.Abp.TenantManagement.Web" Version="5.3.5" /> <PackageReference Include="Volo.Abp.TenantManagement.Web" Version="5.3.5" />
<PackageReference Include="Volo.Abp.SettingManagement.Web" Version="5.3.5" /> <PackageReference Include="Volo.Abp.SettingManagement.Web" Version="5.3.5" />
<PackageReference Include="Yarp.ReverseProxy" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

20
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/appsettings.json

@ -5,6 +5,26 @@
"nodes": "http://config:8848", "nodes": "http://config:8848",
"env": "prod" "env": "prod"
}, },
"ReverseProxy": {
"Routes": {
"ids4": {
"ClusterId": "ids4cluster",
"Match": {
"Path": "/api/connect/{**catch-all}"
},
"Transforms": [ { "PathRemovePrefix": "/api" } ]
}
},
"Clusters": {
"ids4cluster": {
"Destinations": {
"default": {
"Address": "http://localhost:59093/"
}
}
}
}
},
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;", "Default": "Server=dev.ccwin-in.com,13319;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;",
"Auth": "Server=dev.ccwin-in.com,13319;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;" "Auth": "Server=dev.ccwin-in.com,13319;Database=WmsAuth;uid=ccwin-in;pwd=Microsoft@2022;Packet Size=512;"

6
be/Modules/Shared/src/Win_in.Sfs.Shared.Host/HostBuilderExtensions.cs

@ -13,7 +13,9 @@ namespace Win_in.Sfs.Shared.Host;
public static class HostBuilderExtensions public static class HostBuilderExtensions
{ {
public static int BuildAndRun<TModule>(this WebApplicationBuilder builder) where TModule : IAbpModule public static int BuildAndRun<TModule>(this WebApplicationBuilder builder,
Action<WebApplicationBuilder> builderAction = null,
Action<WebApplication> appAction = null) where TModule : IAbpModule
{ {
Serilog.Debugging.SelfLog.Enable(Console.WriteLine); Serilog.Debugging.SelfLog.Enable(Console.WriteLine);
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
@ -44,9 +46,11 @@ public static class HostBuilderExtensions
.Enrich.FromLogContext() .Enrich.FromLogContext()
.WriteTo.Console(formatProvider: CultureInfo.InvariantCulture); .WriteTo.Console(formatProvider: CultureInfo.InvariantCulture);
}, writeToProviders: false); }, writeToProviders: false);
builderAction?.Invoke(builder);
var app = builder.Build(); var app = builder.Build();
app.UseSerilogRequestLogging(); app.UseSerilogRequestLogging();
app.InitializeApplicationAsync().Wait(); app.InitializeApplicationAsync().Wait();
appAction?.Invoke(app);
app.RunAsync().Wait(); app.RunAsync().Wait();
return 0; return 0;
} }

7
build/src/docker/publish/conf/gateway/Caddyfile

@ -8,15 +8,10 @@
reverse_proxy @sfs-core-host /api/* sfs-core-host:59092 reverse_proxy @sfs-core-host /api/* sfs-core-host:59092
@sfs-auth-web { @sfs-auth-web {
path_regexp ^/api/(abp|identity|base|multi-tenancy|permission-management)/* path_regexp ^/api/(abp|identity|base|multi-tenancy|permission-management|token|connect)/*
} }
reverse_proxy @sfs-auth-web /api/* sfs-auth-web:59093 reverse_proxy @sfs-auth-web /api/* sfs-auth-web:59093
@sfs-auth-web-ids {
path_regexp ^/api/(connect)/*
}
reverse_proxy @sfs-auth-web-ids /* sfs-auth-web:59093
@sfs-basedata-host { @sfs-basedata-host {
path_regexp ^/api/basedata/* path_regexp ^/api/basedata/*
} }

7
build/src/docker/publish/conf/gateway/Caddyfile.dev

@ -8,15 +8,10 @@
reverse_proxy @sfs-core-host /api/* host.docker.internal:59092 reverse_proxy @sfs-core-host /api/* host.docker.internal:59092
@sfs-auth-web { @sfs-auth-web {
path_regexp ^/api/(abp|identity|base|multi-tenancy|permission-management)/* path_regexp ^/api/(abp|identity|base|multi-tenancy|permission-management|token|connect)/*
} }
reverse_proxy @sfs-auth-web /api/* host.docker.internal:59093 reverse_proxy @sfs-auth-web /api/* host.docker.internal:59093
@sfs-auth-web-ids {
path_regexp ^/api/(connect)/*
}
reverse_proxy @sfs-auth-web-ids /* host.docker.internal:59093
@sfs-basedata-host { @sfs-basedata-host {
path_regexp ^/api/basedata/* path_regexp ^/api/basedata/*
} }

Loading…
Cancel
Save