Update Steeltoe to 3.2.x
Closes #96 Also externalizes exampled to make easier to update
This commit is contained in:
Родитель
04e842a99b
Коммит
6536f23f9c
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<GoogleAnalyticsTrackerVersion>6.0.7</GoogleAnalyticsTrackerVersion>
|
||||
<SteeltoeVersion>3.1.0</SteeltoeVersion>
|
||||
<SteeltoeVersion>3.2.*</SteeltoeVersion>
|
||||
<YamlDotNetVersion>8.1.2</YamlDotNetVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -61,21 +61,8 @@ namespace Steeltoe.InitializrService.Controllers
|
|||
public IActionResult GetHelp()
|
||||
{
|
||||
var help = new List<string>();
|
||||
if (_serviceOptions?.Logo is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
help.Add(string.Empty);
|
||||
var logoPath = _serviceOptions.Logo;
|
||||
System.IO.File.ReadAllLines(logoPath).ToList().ForEach(l => help.Add(l));
|
||||
help.Add(string.Empty);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
help.Add($"!!! failed to load logo: {e.Message}");
|
||||
help.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
LoadTextResource(_serviceOptions?.Logo, help);
|
||||
|
||||
help.Add(" :: Steeltoe Initializr :: https://start.steeltoe.io");
|
||||
help.Add(string.Empty);
|
||||
|
@ -115,23 +102,32 @@ namespace Steeltoe.InitializrService.Controllers
|
|||
});
|
||||
|
||||
help.AddRange(ToTable(table));
|
||||
help.Add(string.Empty);
|
||||
help.Add("Examples:");
|
||||
help.Add(string.Empty);
|
||||
help.Add("To create a default project:");
|
||||
help.Add("\t$ http https://start.steeltoe.io/api/project -d");
|
||||
help.Add(string.Empty);
|
||||
help.Add("To create a project targeting Steeltoe 2.5.1 and netcoreapp2.1:");
|
||||
help.Add(
|
||||
"\t$ http https://start.steeltoe.io/api/project steeltoeVersion==2.5.1 dotNetFramework==netcoreapp2.1 -d");
|
||||
help.Add(string.Empty);
|
||||
help.Add("To create a project with management endpoints and a Redis backend:");
|
||||
help.Add("\t$ http https://start.steeltoe.io/api/project dependencies==management-endpoints,connector-redis -d");
|
||||
|
||||
LoadTextResource(_serviceOptions?.Examples, help);
|
||||
|
||||
const char newline = '\n';
|
||||
return Ok(string.Join(newline, help));
|
||||
}
|
||||
|
||||
private void LoadTextResource(string resource, List<string> lineBuffer)
|
||||
{
|
||||
if (resource is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lineBuffer.Add(string.Empty);
|
||||
System.IO.File.ReadAllLines(resource).ToList().ForEach(l => lineBuffer.Add(l));
|
||||
lineBuffer.Add(string.Empty);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogWarning("failed to load text resource: {Resource}, {Exception}", resource, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<string> ToTable(IReadOnlyList<List<string>> rows)
|
||||
{
|
||||
var columnMaxWidth = new int[rows[0].Count];
|
||||
|
|
|
@ -37,8 +37,13 @@ namespace Steeltoe.InitializrService
|
|||
public string UiConfigPath => UiConfig?["Path"];
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the logo used for doc header.
|
||||
/// Gets or sets the path to the API documentation logo.
|
||||
/// </summary>
|
||||
public string Logo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the API documentation examples.
|
||||
/// </summary>
|
||||
public string Examples { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"profiles": {
|
||||
"Development": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://127.0.0.1:1920",
|
||||
"launchUrl": "api",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
Examples:
|
||||
|
||||
To create a default project:
|
||||
$ http https://start.steeltoe.io/api/project -d
|
||||
|
||||
To create a project targeting Steeltoe 3.2.0 and net6.0:
|
||||
$ http https://start.steeltoe.io/api/project steeltoeVersion==3.2.0 dotNetFramework==net6.0 -d
|
||||
|
||||
To create a project with management endpoints and a Redis backend:
|
||||
$ http https://start.steeltoe.io/api/project dependencies==management-endpoints,connector-redis -d
|
|
@ -31,3 +31,4 @@
|
|||
,....',,,,,,,,,,;
|
||||
:'..,,,,,,:
|
||||
;,;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace Steeltoe.InitializrService
|
|||
_netCoreToolServiceUri = options?.NetCoreToolServiceUri;
|
||||
if (options?.UiConfigPath is null)
|
||||
{
|
||||
services.ConfigureConfigServerClientOptions(Configuration);
|
||||
services.ConfigureConfigServerClientOptions();
|
||||
services.Configure<UiConfig>(Configuration);
|
||||
services.AddTransient<IUiConfigService, UiConfigService>();
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ namespace Steeltoe.InitializrService
|
|||
services.AddResponseCompression();
|
||||
services.AddTransient<IProjectGenerator, NetCoreToolProjectGenerator>();
|
||||
services.AddAllActuators();
|
||||
services.ActivateActuatorEndpoints();
|
||||
services.AddGoogleAnalyticsTracker(trackerOptions => { trackerOptions.TrackerId = "UA-114912118-2"; });
|
||||
services.AddControllers().AddJsonOptions(jsonOptions =>
|
||||
{
|
||||
|
@ -117,7 +118,6 @@ namespace Steeltoe.InitializrService
|
|||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapAllActuators();
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"InitializrService": {
|
||||
"Logo": "Resources/logo.txt",
|
||||
"NetCoreToolService": {
|
||||
"Uri": "http://net-core-tool-service/api"
|
||||
}
|
||||
},
|
||||
"Logo": "Resources/logo.txt",
|
||||
"Examples": "Resources/examples.txt"
|
||||
},
|
||||
"Spring": {
|
||||
"Application": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче