forked from deislabs/wagi-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from simongdavies/bindle-template
Bindle template
- Loading branch information
Showing
13 changed files
with
730 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
source/dotnettemplates/templates/wagi_bindle_project/.template.config/template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/template", | ||
"author": "Simon Davies", | ||
"classifications": [ | ||
"Web", | ||
"ASP.NET", | ||
"WASM", | ||
"WAGI", | ||
"Bindle" | ||
], | ||
"identity": "Deislabs.WAGI.Templates.BindleWebApp", | ||
"name": "ASP.NET WAGI Bindle Web App", | ||
"shortName": "wagi-bindle", | ||
"description": "Creates a new C# dotnet web app configured with the Deislabs wagi-dotnet extension configured to serve modules hosted in a bindle server.", | ||
"tags": { | ||
"language": "C#", | ||
"type": "project" | ||
}, | ||
"sourceName": "Wagi.Project", | ||
"preferNameDirectory": true, | ||
"symbols": { | ||
"os": { | ||
"type": "bind", | ||
"binding": "OS" | ||
}, | ||
"bindle-server-url": { | ||
"type": "parameter", | ||
"isRequired": true, | ||
"replaces": "bindle_server_url", | ||
"description": "This is URL that the bindle server is listening on" | ||
}, | ||
"base-path": { | ||
"type": "parameter", | ||
"defaultValue": "/", | ||
"description": "This is the base path in that the server will prepend to the routes defined in the bindle", | ||
"replaces":"base_route" | ||
}, | ||
"bindle-name": { | ||
"type": "parameter", | ||
"isRequired": true, | ||
"replaces": "bindle_name", | ||
"description": "This is name of the bindle to deploy." | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
source/dotnettemplates/templates/wagi_bindle_project/.vscode/launch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": ".NET Core Launch (web)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
"program": "${workspaceFolder}/bin/Debug/net5.0/Wagi.Project.dll", | ||
"args": [ ], | ||
"cwd": "${workspaceFolder}", | ||
"console": "internalConsole", | ||
"env":{ | ||
"WASMTIME_BACKTRACE_DETAILS":"1", | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"stopAtEntry": false | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach", | ||
"processId": "${command:pickProcess}" | ||
}, | ||
{ | ||
"name": ".NET Core Launch (listen)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
"env":{ | ||
"WASMTIME_BACKTRACE_DETAILS":"1", | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"program": "${workspaceFolder}/bin/Debug/net5.0/Wagi.Project.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}", | ||
"console": "internalConsole", | ||
"stopAtEntry": false | ||
} | ||
] | ||
} |
42 changes: 42 additions & 0 deletions
42
source/dotnettemplates/templates/wagi_bindle_project/.vscode/tasks.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}/Wagi.Project.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "publish", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"publish", | ||
"${workspaceFolder}/Wagi.Project.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "watch", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"watch", | ||
"run", | ||
"${workspaceFolder}/Wagi.Project.csproj", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
source/dotnettemplates/templates/wagi_bindle_project/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Wagi.Project | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
source/dotnettemplates/templates/wagi_bindle_project/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"profiles": { | ||
"wagi.project": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": "true", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"WASMTIME_BACKTRACE_DETAILS":1 | ||
} | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
source/dotnettemplates/templates/wagi_bindle_project/Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Deislabs.Wagi.Extensions; | ||
|
||
namespace Wagi.Project | ||
{ | ||
public class Startup | ||
{ | ||
|
||
public Startup(IConfiguration configuration) | ||
{ | ||
Configuration = configuration; | ||
} | ||
|
||
public IConfiguration Configuration { get; } | ||
|
||
// This method gets called by the runtime. Use this method to add services to the container. | ||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
|
||
// HTTP Client is required for wasi_experimentatl_http support. | ||
services.AddHttpClient(); | ||
// This adds the services required for using WAGI Modules, by default configuration is expected to be found in a section named Wagi, if the section is renamed then the name should be passed as the second argument. | ||
services.AddWagi(Configuration); | ||
} | ||
|
||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | ||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | ||
{ | ||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
|
||
app.UseRouting(); | ||
|
||
app.UseEndpoints(endpoints => | ||
{ | ||
// This builds the routes defined by Wagi Modules, if configuration changes the endpoint routing will be automatically updated. | ||
endpoints.MapWagiModules(); | ||
}); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
source/dotnettemplates/templates/wagi_bindle_project/Wagi.Project.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Deislabs.WAGI" Version="0.9.0-preview" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Content Include=".\modules\*.*"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
</Project> |
20 changes: 20 additions & 0 deletions
20
source/dotnettemplates/templates/wagi_bindle_project/appsettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information", | ||
"Deislabs.WAGI": "Trace" | ||
} | ||
}, | ||
"Wagi": { | ||
"ModulePath": "modules", | ||
"BindleServer": "bindle_server_url", | ||
"Bindles": { | ||
"BindleModule": { | ||
"Name": "bindle_name", | ||
"Route": "base_route" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.