From e42d843c5306d3594dd7f310820675fad6e54982 Mon Sep 17 00:00:00 2001 From: zhontai <361243234@qq.com> Date: Mon, 6 Jan 2025 11:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=91=E5=85=B3=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=A8=A1=E6=9D=BF=20ZhonTai.Template.Gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gateways/ZhonTai.Gateway.Yarp/Program.cs | 13 +- templates/gateway/content/.dockerignore | 25 ++ templates/gateway/content/.gitignore | 400 ++++++++++++++++++ .../content/.template.config/template.json | 18 + templates/gateway/content/LICENSE | 21 + .../Core/Configs/GatewayConfig.cs | 28 ++ .../MyGateway.Host/MyGateway.Host.csproj | 15 + .../gateway/content/MyGateway.Host/Program.cs | 72 ++++ .../Properties/launchSettings.json | 39 ++ .../appsettings.Development.json | 8 + .../content/MyGateway.Host/appsettings.json | 46 ++ .../content/MyGateway.Host/nlog.config | 63 +++ templates/gateway/content/MyGateway.sln | 22 + templates/gateway/content/README.md | 38 ++ templates/gateway/license/LICENSE | 21 + templates/gateway/logo.png | Bin 0 -> 2775 bytes templates/gateway/templates.nuspec | 29 ++ templates/im/content/.dockerignore | 25 ++ templates/im/content/.gitignore | 400 ++++++++++++++++++ templates/im/content/LICENSE | 21 + 20 files changed, 1300 insertions(+), 4 deletions(-) create mode 100644 templates/gateway/content/.dockerignore create mode 100644 templates/gateway/content/.gitignore create mode 100644 templates/gateway/content/.template.config/template.json create mode 100644 templates/gateway/content/LICENSE create mode 100644 templates/gateway/content/MyGateway.Host/Core/Configs/GatewayConfig.cs create mode 100644 templates/gateway/content/MyGateway.Host/MyGateway.Host.csproj create mode 100644 templates/gateway/content/MyGateway.Host/Program.cs create mode 100644 templates/gateway/content/MyGateway.Host/Properties/launchSettings.json create mode 100644 templates/gateway/content/MyGateway.Host/appsettings.Development.json create mode 100644 templates/gateway/content/MyGateway.Host/appsettings.json create mode 100644 templates/gateway/content/MyGateway.Host/nlog.config create mode 100644 templates/gateway/content/MyGateway.sln create mode 100644 templates/gateway/content/README.md create mode 100644 templates/gateway/license/LICENSE create mode 100644 templates/gateway/logo.png create mode 100644 templates/gateway/templates.nuspec create mode 100644 templates/im/content/.dockerignore create mode 100644 templates/im/content/.gitignore create mode 100644 templates/im/content/LICENSE diff --git a/src/gateways/ZhonTai.Gateway.Yarp/Program.cs b/src/gateways/ZhonTai.Gateway.Yarp/Program.cs index 29599f7e..004ca505 100644 --- a/src/gateways/ZhonTai.Gateway.Yarp/Program.cs +++ b/src/gateways/ZhonTai.Gateway.Yarp/Program.cs @@ -1,4 +1,5 @@ using NLog.Web; +using System.Reflection; using ZhonTai.Gateway.Yarp.Core.Configs; var builder = WebApplication.CreateBuilder(args); @@ -8,8 +9,10 @@ //使用NLog日志 builder.Host.UseNLog(); +//添加健康检查 builder.Services.AddHealthChecks(); +//添加跨域 builder.Services.AddCors(options => { options.AddPolicy("AllowAnyPolicy", policy => @@ -21,6 +24,7 @@ }); }); +//添加代理 builder.Services.AddReverseProxy() .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); @@ -30,14 +34,16 @@ // Configure the HTTP request pipeline. +//使用跨域 app.UseCors("AllowAnyPolicy"); +//使用健康检查 app.MapHealthChecks("/health"); +//使用代理 app.MapReverseProxy(); -//app.MapGet("/", () => $"The {Assembly.GetEntryAssembly()?.GetName().Name} has started."); - +//首页 app.MapGet("/", async (HttpResponse response) => { var gatewayConfig = builder.Configuration.GetSection("GatewayConfig").Get(); @@ -54,7 +60,7 @@ } else { - html += "MyGateway.Host start!"; + html += $"The {Assembly.GetEntryAssembly()?.GetName().Name} has started."; } html += ""; @@ -63,5 +69,4 @@ await response.WriteAsync(html); }); - app.Run(); \ No newline at end of file diff --git a/templates/gateway/content/.dockerignore b/templates/gateway/content/.dockerignore new file mode 100644 index 00000000..3729ff0c --- /dev/null +++ b/templates/gateway/content/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/templates/gateway/content/.gitignore b/templates/gateway/content/.gitignore new file mode 100644 index 00000000..4848cc02 --- /dev/null +++ b/templates/gateway/content/.gitignore @@ -0,0 +1,400 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +**/wwwroot/upload \ No newline at end of file diff --git a/templates/gateway/content/.template.config/template.json b/templates/gateway/content/.template.config/template.json new file mode 100644 index 00000000..a0bca989 --- /dev/null +++ b/templates/gateway/content/.template.config/template.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "xiao xue", + "classifications": [ "ZhonTai", "Gateway", "MyGateway" ], + "name": "ZhonTai.Template Gateway网关项目", + "identity": "MyGateway", + "shortName": "MyGateway", + "tags": { + "language": "C#", + "type": "project" + }, + "sourceName": "MyGateway", + "preferNameDirectory": true, + "symbols": { + }, + "sources": [ + ] +} \ No newline at end of file diff --git a/templates/gateway/content/LICENSE b/templates/gateway/content/LICENSE new file mode 100644 index 00000000..c64c1d36 --- /dev/null +++ b/templates/gateway/content/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 myapp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/templates/gateway/content/MyGateway.Host/Core/Configs/GatewayConfig.cs b/templates/gateway/content/MyGateway.Host/Core/Configs/GatewayConfig.cs new file mode 100644 index 00000000..93579018 --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/Core/Configs/GatewayConfig.cs @@ -0,0 +1,28 @@ +namespace MyGateway.Host.Core.Configs; + +public class GatewayConfig +{ + public static class Models + { + /// + /// 模块信息 + /// + public class ModuleInfo + { + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 路径 + /// + public string Url { get; set; } + } + } + + /// + /// 模块列表 + /// + public List ModuleList { get; set; } +} diff --git a/templates/gateway/content/MyGateway.Host/MyGateway.Host.csproj b/templates/gateway/content/MyGateway.Host/MyGateway.Host.csproj new file mode 100644 index 00000000..686898e9 --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/MyGateway.Host.csproj @@ -0,0 +1,15 @@ + + + Yarp网关 + + + + net9.0 + enable + + + + + + + diff --git a/templates/gateway/content/MyGateway.Host/Program.cs b/templates/gateway/content/MyGateway.Host/Program.cs new file mode 100644 index 00000000..aaa95cad --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/Program.cs @@ -0,0 +1,72 @@ +using System.Reflection; +using MyGateway.Host.Core.Configs; +using NLog.Web; + +var builder = WebApplication.CreateBuilder(args); + +//־Ӧ򣬱.netԴ־̨ +builder.Logging.ClearProviders(); +//ʹNLog־ +builder.Host.UseNLog(); + +//ӽ +builder.Services.AddHealthChecks(); + +//ӿ +builder.Services.AddCors(options => +{ + options.AddPolicy("AllowAnyPolicy", policy => + { + policy + .AllowAnyOrigin() + .AllowAnyHeader() + .AllowAnyMethod(); + }); +}); + +//Ӵ +builder.Services.AddReverseProxy() + .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); + +// Add services to the container. + +var app = builder.Build(); + +// Configure the HTTP request pipeline. + +//ʹÿ +app.UseCors("AllowAnyPolicy"); + +//ʹý +app.MapHealthChecks("/health"); + +//ʹô +app.MapReverseProxy(); + +//ҳ +app.MapGet("/", async (HttpResponse response) => +{ + var gatewayConfig = builder.Configuration.GetSection("GatewayConfig").Get(); + + var moduleList = gatewayConfig.ModuleList; + + var html = $""; + if (moduleList?.Count > 0) + { + moduleList.ForEach(m => + { + html += $"""{m.Name}
"""; + }); + } + else + { + html += $"The {Assembly.GetEntryAssembly()?.GetName().Name} has started."; + } + html += ""; + + response.ContentType = "text/html;charset=UTF-8"; + + await response.WriteAsync(html); +}); + +app.Run(); \ No newline at end of file diff --git a/templates/gateway/content/MyGateway.Host/Properties/launchSettings.json b/templates/gateway/content/MyGateway.Host/Properties/launchSettings.json new file mode 100644 index 00000000..a5c01b5b --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/Properties/launchSettings.json @@ -0,0 +1,39 @@ +{ + "profiles": { + "MyGateway.Host": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:16010" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": false + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:16010", + "sslPort": 0 + } + } +} \ No newline at end of file diff --git a/templates/gateway/content/MyGateway.Host/appsettings.Development.json b/templates/gateway/content/MyGateway.Host/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/templates/gateway/content/MyGateway.Host/appsettings.json b/templates/gateway/content/MyGateway.Host/appsettings.json new file mode 100644 index 00000000..8aa08052 --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/appsettings.json @@ -0,0 +1,46 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ReverseProxy": { + "Routes": { + "admin": { + "ClusterId": "admin", + "Match": { + "Path": "/api/admin/{*any}", + "Methods": [ "POST", "GET", "DELETE", "PUT" ], + "Hosts": [] + } + }, + "admin-doc": { + "ClusterId": "admin", + "Match": { + "Path": "/doc/admin/{*any}", + "Methods": [ "POST", "GET", "DELETE", "PUT" ], + "Hosts": [] + } + } + }, + "Clusters": { + "admin": { + "Destinations": { + "destination1": { + "Address": "http://localhost:18010" + } + } + } + } + }, + "GatewayConfig": { + "ModuleList": [ + { + "Name": "权限接口文档", + "Url": "/doc/admin/index.html" + } + ] + } +} \ No newline at end of file diff --git a/templates/gateway/content/MyGateway.Host/nlog.config b/templates/gateway/content/MyGateway.Host/nlog.config new file mode 100644 index 00000000..57f10690 --- /dev/null +++ b/templates/gateway/content/MyGateway.Host/nlog.config @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO "ad_log"("Id", "Logged", "Level", "Message", "Logger", "Properties", "Callsite", "Exception") VALUES(@Id, @Logged, @Level, @Message, @Logger, @Properties, @Callsite, @Exception) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/gateway/content/MyGateway.sln b/templates/gateway/content/MyGateway.sln new file mode 100644 index 00000000..51150153 --- /dev/null +++ b/templates/gateway/content/MyGateway.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyGateway.Host", "MyGateway.Host\MyGateway.Host.csproj", "{FD5DA41A-2C9D-4AA8-BA19-542CA29CDE17}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD5DA41A-2C9D-4AA8-BA19-542CA29CDE17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD5DA41A-2C9D-4AA8-BA19-542CA29CDE17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD5DA41A-2C9D-4AA8-BA19-542CA29CDE17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD5DA41A-2C9D-4AA8-BA19-542CA29CDE17}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/templates/gateway/content/README.md b/templates/gateway/content/README.md new file mode 100644 index 00000000..a2493513 --- /dev/null +++ b/templates/gateway/content/README.md @@ -0,0 +1,38 @@ +MyGateWay网关项目模板说明 + +********************************************************* + +### nuget下载地址 +``` +https://www.nuget.org/downloads +``` +> 将`nuget.exe`放到 `F:\zhontai\Admin.Core\templates` 目录下 + +### 查看模板列表 +``` +dotnet new list +``` + +### 生成nuget包 +在 `F:\zhontai\Admin.Core\templates` 目录下 cmd 执行以下命令生成nuget包 +``` +nuget pack F:\zhontai\Admin.Core\templates\gateway\templates.nuspec -NoDefaultExcludes +``` +### 安装模板 +``` +dotnet new install ZhonTai.Template.GateWay +``` +安装本地 +``` +dotnet new install F:\zhontai\Admin.Core\templates\ZhonTai.Template.GateWay.1.0.0.nupkg +``` + +### 创建项目 +``` +dotnet new MyGateWay -n MyCompanyName.GateWay +``` + +### 卸载模板 +``` +dotnet new uninstall ZhonTai.Template.GateWay +``` diff --git a/templates/gateway/license/LICENSE b/templates/gateway/license/LICENSE new file mode 100644 index 00000000..4e3c578f --- /dev/null +++ b/templates/gateway/license/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 zhontai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/templates/gateway/logo.png b/templates/gateway/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1c76fbf3fb952560e887b8a6a3b182bff0ec1dcc GIT binary patch literal 2775 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 R_1#hmz+A){7aO`p{15&TS^fY3 literal 0 HcmV?d00001 diff --git a/templates/gateway/templates.nuspec b/templates/gateway/templates.nuspec new file mode 100644 index 00000000..51a59e60 --- /dev/null +++ b/templates/gateway/templates.nuspec @@ -0,0 +1,29 @@ + + + + ZhonTai.Template.Gateway + 9.0.0 + xiao xue + zhon tai + https://github.com/zhontai/Admin.Core + + MIT + + + Copyright ©2020 zhontai + 中台网关项目模板 + ZhonTai Gateway MyGateway + logo.png + + + + + + $CommonFileElements$ + + + + \ No newline at end of file diff --git a/templates/im/content/.dockerignore b/templates/im/content/.dockerignore new file mode 100644 index 00000000..3729ff0c --- /dev/null +++ b/templates/im/content/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/templates/im/content/.gitignore b/templates/im/content/.gitignore new file mode 100644 index 00000000..4848cc02 --- /dev/null +++ b/templates/im/content/.gitignore @@ -0,0 +1,400 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +**/wwwroot/upload \ No newline at end of file diff --git a/templates/im/content/LICENSE b/templates/im/content/LICENSE new file mode 100644 index 00000000..c64c1d36 --- /dev/null +++ b/templates/im/content/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 myapp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file