commit | 2c361e1be5020ee07b784c974ad4aed7d7f71300 | [log] [tgz] |
---|---|---|
author | Han Gao <dhangao@hotmail.com> | Thu Jun 09 19:56:25 2022 +0800 |
committer | GitHub <noreply@github.com> | Thu Jun 09 19:56:25 2022 +0800 |
tree | 67af73e43412c263d1def23190f52484c45b5783 | |
parent | bba654675c17cbeec31c93d9375323c645df1db7 [diff] |
[ISSUE #14] Add CI for building, testing, license checking and codeQL check (#15) * test ci * add .licenserc.yaml * add ignore paths for license check * add codeql analysis workflow * fix small bug * add one unit test and ci for UT * add UT and code coverage workflow * change trigger to main branch * remove deprecated test project
For ASP.NET Core project, we can refer to the example code at examples/AspNetCoreExample
. What you need to do is quite simple and straightforward.
dotnet add package <todo>
Startup.ConfigureServices
method, add the ShenyuRegister
service.public void ConfigureServices(IServiceCollection services) { ... services.AddShenyuRegister(this.Configuration); ... }
Shenyu
configurations in appsettings.json
.{ "Shenyu": { "Register": { "ServerList": "http://localhost:9095", "Props": { "UserName": "<your_admin_user>", "Password": "<your_admin_password>" } }, "Client": { "AppName": "dotnet-example", "ContextPath": "/dotnet", "IsFull": false, "ClientType": "http" } } }
When running on your local machine, ASP.NET Core service can only be called from localhost
. To enable calling by IP, you can replace https://localhost:{port};http://localhost:{port}
with https://*:{port};http://*:{port}
by one of the following ways.
launchSettings.json
. Replace for applicationUrl
field.ASPNETCORE_URLS
. e.g. ASPNETCORE_URLS "http://*:5000"
--urls
when start. e.g. dotnet run --urls "https://*:5001;http://*:5000"
UseUrls()
in Program.cs
.e.g.
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); webBuilder.UseUrls("http://*:5000", "https://*:5001"); });
That's all! After finished above steps, you can just start your project and you can visit shenyu-admin
portal to see the APIs have been registered in Shenyu.