dataView);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.TemplateEngine/Services/Mustache/SourceFile.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | namespace Steeltoe.Initializr.TemplateEngine.Services.Mustache
16 | {
17 | public class SourceFile
18 | {
19 | public string Name { get; set; }
20 |
21 | public string FullPath { get; set; }
22 |
23 | public string Text { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/config/jest/cssTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // This is a custom Jest transformer turning style imports into empty objects.
4 | // http://facebook.github.io/jest/docs/en/webpack.html
5 |
6 | module.exports = {
7 | process() {
8 | return 'module.exports = {};';
9 | },
10 | getCacheKey() {
11 | // The output is always the same.
12 | return 'cssTransform';
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/config/pnpTs.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const { resolveModuleName } = require('ts-pnp');
4 |
5 | exports.resolveModuleName = (
6 | typescript,
7 | moduleName,
8 | containingFile,
9 | compilerOptions,
10 | resolutionHost
11 | ) => {
12 | return resolveModuleName(
13 | moduleName,
14 | containingFile,
15 | compilerOptions,
16 | resolutionHost,
17 | typescript.resolveModuleName
18 | );
19 | };
20 |
21 | exports.resolveTypeReferenceDirective = (
22 | typescript,
23 | moduleName,
24 | containingFile,
25 | compilerOptions,
26 | resolutionHost
27 | ) => {
28 | return resolveModuleName(
29 | moduleName,
30 | containingFile,
31 | compilerOptions,
32 | resolutionHost,
33 | typescript.resolveTypeReferenceDirective
34 | );
35 | };
36 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/public/beta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/Initializr/1ac72d1e50e7c8e3209f21c962d563ee56f17da9/src/Steeltoe.Initializr.WebApp/ClientApp/public/beta.png
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SteeltoeOSS/Initializr/1ac72d1e50e7c8e3209f21c962d563ee56f17da9/src/Steeltoe.Initializr.WebApp/ClientApp/public/favicon.png
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Steeltoe Initializr",
3 | "name": "Steeltoe Initializr",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/src/App.js:
--------------------------------------------------------------------------------
1 | import ReactGA from 'react-ga'
2 | import React, { Component } from 'react';
3 | import { Route } from 'react-router';
4 | import { Layout } from './components/Layout';
5 | import { Home } from './components/Home';
6 |
7 | ReactGA.initialize('UA-114912118-2');
8 | ReactGA.pageview(window.location.pathname + window.location.search);
9 | export default class App extends Component {
10 | static displayName = App.name;
11 |
12 | render () {
13 | return (
14 |
15 |
16 |
17 | );
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { MemoryRouter } from 'react-router-dom';
4 | import App from './App';
5 |
6 | it('renders without crashing', () => {
7 | const div = document.createElement('div');
8 | ReactDOM.render(
9 |
10 |
11 | , div);
12 | });
13 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/src/components/BottomLinks.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export class BottomLinks extends Component {
4 |
5 | render () {
6 | return (
7 |
8 |
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/src/components/InputText.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export class InputText extends Component {
4 |
5 | render () {
6 | const {title, ...inputProps} = this.props;
7 | return (
8 |
9 |
10 |
11 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/src/components/Layout.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Container } from 'reactstrap';
3 | import { NavMenu } from './NavMenu';
4 |
5 | export class Layout extends Component {
6 | static displayName = Layout.name;
7 |
8 | render () {
9 | return (
10 |
11 |
12 |
13 | {this.props.children}
14 |
15 |
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/ClientApp/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { BrowserRouter } from 'react-router-dom';
4 | import App from './App';
5 | import registerServiceWorker from './registerServiceWorker';
6 |
7 | const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
8 | const rootElement = document.getElementById('root');
9 |
10 | ReactDOM.render(
11 |
12 |
13 | ,
14 | rootElement);
15 |
16 | registerServiceWorker();
17 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Controllers/IsNotHtmlRequestAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Microsoft.AspNetCore.Mvc.Abstractions;
16 | using Microsoft.AspNetCore.Mvc.ActionConstraints;
17 | using Microsoft.AspNetCore.Routing;
18 | using System.Linq;
19 |
20 | namespace Steeltoe.Initializr.WebApp.Controllers
21 | {
22 | public class IsNotHtmlRequestAttribute : ActionMethodSelectorAttribute
23 | {
24 | public override bool IsValidForRequest(RouteContext routeContext, ActionDescriptor action)
25 | {
26 | return !routeContext.HttpContext.Request.Headers["Accept"].Any(
27 | h => h.Split(",").Contains("text/html"));
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Microsoft.AspNetCore;
16 | using Microsoft.AspNetCore.Hosting;
17 |
18 | namespace Steeltoe.Initializr.WebApp
19 | {
20 | public static class Program
21 | {
22 | public static void Main(string[] args)
23 | {
24 | CreateWebHostBuilder(args).Build().Run();
25 | }
26 |
27 | private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
28 | WebHost.CreateDefaultBuilder(args)
29 | .UseStartup();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Properties/PublishProfiles/FolderProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | FileSystem
9 | FileSystem
10 | Release
11 | Any CPU
12 |
13 | True
14 | False
15 | netcoreapp2.2
16 | linux-x64
17 | fe01a64f-e44d-4edc-b9a0-b33521d5a254
18 | true
19 | <_IsPortable>false
20 | bin\Release\netcoreapp2.2\publish\
21 | False
22 |
23 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Properties/PublishProfiles/FolderProfile.pubxml.user:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 | <_PublishTargetUrl>C:\Users\Hananiel\projects\InitializrApi\src\bin\Release\netcoreapp2.2\publish\
10 |
11 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:47802",
8 | "sslPort": 44372
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "Steeltoe.Initializr": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "https://localhost:5001",
24 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Steeltoe.Initializr.WebApp.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ProjectDebugger
5 |
6 |
7 | Steeltoe.Initializr
8 | FolderProfile
9 |
10 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/Steeltoe.Initializr.WebApp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Steeltoe.Initializr.WebApp
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning",
5 | "Microsoft.Hosting.Lifetime": "Information"
6 | }
7 | },
8 | "AllowedHosts": "*",
9 | "FriendlyNames": {
10 | "SQLServer": "SQL Server",
11 | "PostgresEFCore": "Postgres EFCore",
12 | "CloudFoundry": "Cloud Foundry",
13 | "MySqlEFCore": "MySQL EFCore",
14 | "MySqlEF6": "MySQL EF6",
15 | "OAuthConnector": "OAuth Connector",
16 | "DynamicLogger": "Dynamic Logger",
17 | "CircuitBreaker": "Circuit Breaker"
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/manifest-dev.yml:
--------------------------------------------------------------------------------
1 | ---
2 | applications:
3 | - name: startsteeltoe-stage
4 | buildpacks:
5 | - dotnet_core_buildpack
6 | memory: 1024M
7 | command: cd ${HOME} && ./Steeltoe.Initializr.WebApp
8 | env:
9 | ASPNETCORE_ENVIRONMENT: Production
10 |
--------------------------------------------------------------------------------
/src/Steeltoe.Initializr.WebApp/manifest.yml:
--------------------------------------------------------------------------------
1 | ---
2 | applications:
3 | - name: startsteeltoe-prod
4 | buildpacks:
5 | - dotnet_core_buildpack
6 | memory: 1024M
7 | command: cd ${HOME} && ./Steeltoe.Initializr.WebApp
8 | env:
9 | ASPNETCORE_ENVIRONMENT: Production
10 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS base
2 | WORKDIR /app
3 | EXPOSE 80
4 |
5 | FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build
6 | WORKDIR /src
7 | COPY ["{{ProjectNameSpace}}.csproj", "."]
8 | RUN dotnet restore "{{ProjectNameSpace}}.csproj"
9 | COPY . .
10 | RUN dotnet build "{{ProjectNameSpace}}.csproj" -c Release -o /app
11 |
12 | FROM build AS publish
13 | RUN dotnet publish "{{ProjectNameSpace}}.csproj" -c Release -o /app
14 |
15 | FROM base AS final
16 | WORKDIR /app
17 | COPY --from=publish /app .
18 | ENTRYPOINT ["dotnet", "{{ProjectNameSpace}}.dll"]
19 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/Models/ConfigServerData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace {{ProjectNameSpace}}
7 | {
8 | ///
9 | /// An object used with the DI Options mechanism for exposing the data retrieved
10 | /// from the Spring Cloud Config Server
11 | ///
12 | public class ConfigServerData
13 | {
14 | public string Bar { get; set; }
15 | public string Foo { get; set; }
16 | public Info Info { get; set; }
17 |
18 | }
19 |
20 | public class Info
21 | {
22 | public string Description { get; set; }
23 | public string Url { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace {{ProjectNameSpace}}
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/Models/InitializeContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.Logging;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 |
9 | namespace {{ProjectNameSpace}}
10 | {
11 | public static class InitializeContext
12 | {
13 | public static IWebHost InitializeDbContexts(this IWebHost host)
14 | {
15 | using (var scope = host.Services.CreateScope())
16 | {
17 | var services = scope.ServiceProvider;
18 | try
19 | {
20 | SampleData.InitializeMyContexts(services);
21 | }
22 | catch (Exception ex)
23 | {
24 | var logger = services.GetRequiredService>();
25 | logger.LogError(ex, "An error occurred seeding the DB.");
26 | }
27 | }
28 | return host;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/Models/TestContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using System.ComponentModel.DataAnnotations;
3 | using System.ComponentModel.DataAnnotations.Schema;
4 |
5 | namespace {{ProjectNameSpace}}
6 | {
7 | public class TestContext : DbContext
8 | {
9 | public TestContext(DbContextOptions options) : base(options)
10 | {
11 |
12 | }
13 |
14 | public DbSet TestData { get; set; }
15 | }
16 |
17 | public class TestData
18 | {
19 | [Key]
20 | [DatabaseGenerated(DatabaseGeneratedOption.None)]
21 | public int Id { get; set; }
22 |
23 | public string Data { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/MyCircuitBreakerCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Steeltoe.CircuitBreaker.Hystrix;
6 | namespace {{ProjectNameSpace}}
7 | {
8 | public class MyCircuitBreakerCommand : HystrixCommand
9 | {
10 | private string _name;
11 | public MyCircuitBreakerCommand(string name): base(HystrixCommandGroupKeyDefault.AsKey("MyCircuitBreakerGroup"))
12 | {
13 | _name = name;
14 | IsFallbackUserDefined = true;
15 | }
16 | protected override async Task RunAsync()
17 | {
18 | return await Task.FromResult("Hello " + _name);
19 | }
20 | protected override async Task RunFallbackAsync()
21 | {
22 | return await Task.FromResult("Hello " + _name + " via fallback");
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp2.1/webapi/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | {{#PlaceholderConfig}}
3 | "ResolvedPlaceholderFromEnvVariables": "${PATH?NotFound}",
4 | "UnresolvedPlaceholder": "${SomKeyNotFound?NotFound}",
5 | "ResolvedPlaceholderFromJson": "${Logging:LogLevel:System?${Loggin:LogLevel:Default}}",
6 | {{/PlaceholderConfig}}
7 | "Logging": {
8 | "LogLevel": {
9 | "Default": "Debug",
10 | "System": "Information",
11 | "Microsoft": "Information"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
2 | WORKDIR /app
3 | EXPOSE 80
4 |
5 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
6 | WORKDIR /src
7 | COPY ["{{ProjectNameSpace}}.csproj", "."]
8 | RUN dotnet restore "{{ProjectNameSpace}}.csproj"
9 | COPY . .
10 | RUN dotnet build "{{ProjectNameSpace}}.csproj" -c Release -o /app
11 |
12 | FROM build AS publish
13 | RUN dotnet publish "{{ProjectNameSpace}}.csproj" -c Release -o /app
14 |
15 | FROM base AS final
16 | WORKDIR /app
17 | COPY --from=publish /app .
18 | ENTRYPOINT ["dotnet", "{{ProjectNameSpace}}.dll"]
19 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace {{ProjectNameSpace}}
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/Models/InitializeContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.Logging;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 |
9 | namespace {{ProjectNameSpace}}
10 | {
11 | public static class InitializeContext
12 | {
13 | public static IWebHost InitializeDbContexts(this IWebHost host)
14 | {
15 | using (var scope = host.Services.CreateScope())
16 | {
17 | var services = scope.ServiceProvider;
18 | try
19 | {
20 | SampleData.InitializeMyContexts(services);
21 | }
22 | catch (Exception ex)
23 | {
24 | var logger = services.GetRequiredService>();
25 | logger.LogError(ex, "An error occurred seeding the DB.");
26 | }
27 | }
28 | return host;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/Models/TestContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using System.ComponentModel.DataAnnotations;
3 | using System.ComponentModel.DataAnnotations.Schema;
4 |
5 | namespace {{ProjectNameSpace}}
6 | {
7 | public class TestContext : DbContext
8 | {
9 | public TestContext(DbContextOptions options) : base(options)
10 | {
11 |
12 | }
13 |
14 | public DbSet TestData { get; set; }
15 | }
16 |
17 | public class TestData
18 | {
19 | [Key]
20 | [DatabaseGenerated(DatabaseGeneratedOption.None)]
21 | public int Id { get; set; }
22 |
23 | public string Data { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/MyCircuitBreakerCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Steeltoe.CircuitBreaker.Hystrix;
6 |
7 | namespace {{ProjectNameSpace}}
8 | {
9 | public class MyCircuitBreakerCommand : HystrixCommand
10 | {
11 | private string _name;
12 | public MyCircuitBreakerCommand(string name): base(HystrixCommandGroupKeyDefault.AsKey("MyCircuitBreakerGroup"))
13 | {
14 | _name = name;
15 | IsFallbackUserDefined = true;
16 | }
17 | protected override async Task RunAsync()
18 | {
19 | return await Task.FromResult("Hello " + _name);
20 | }
21 | protected override async Task RunFallbackAsync()
22 | {
23 | return await Task.FromResult("Hello " + _name + " via fallback");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/templates/Mustache/2.4/netcoreapp3.1/webapi/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | {{#PlaceholderConfig}}
3 | "ResolvedPlaceholderFromEnvVariables": "${PATH?NotFound}",
4 | "UnresolvedPlaceholder": "${SomKeyNotFound?NotFound}",
5 | "ResolvedPlaceholderFromJson": "${Logging:LogLevel:System?${Loggin:LogLevel:Default}}",
6 | {{/PlaceholderConfig}}
7 | "Logging": {
8 | "LogLevel": {
9 | "Default": "Debug",
10 | "System": "Information",
11 | "Microsoft": "Information"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
2 | WORKDIR /app
3 | EXPOSE 80
4 |
5 | FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
6 | WORKDIR /src
7 | COPY ["{{ProjectNameSpace}}.csproj", "."]
8 | RUN dotnet restore "{{ProjectNameSpace}}.csproj"
9 | COPY . .
10 | RUN dotnet build "{{ProjectNameSpace}}.csproj" -c Release -o /app
11 |
12 | FROM build AS publish
13 | RUN dotnet publish "{{ProjectNameSpace}}.csproj" -c Release -o /app
14 |
15 | FROM base AS final
16 | WORKDIR /app
17 | COPY --from=publish /app .
18 | ENTRYPOINT ["dotnet", "{{ProjectNameSpace}}.dll"]
19 |
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace {{ProjectNameSpace}}
4 | {
5 | public class ErrorViewModel
6 | {
7 | public string RequestId { get; set; }
8 |
9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/Models/InitializeContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.DependencyInjection;
3 | using Microsoft.Extensions.Logging;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 |
9 | namespace {{ProjectNameSpace}}
10 | {
11 | public static class InitializeContext
12 | {
13 | public static IWebHost InitializeDbContexts(this IWebHost host)
14 | {
15 | using (var scope = host.Services.CreateScope())
16 | {
17 | var services = scope.ServiceProvider;
18 | try
19 | {
20 | SampleData.InitializeMyContexts(services);
21 | }
22 | catch (Exception ex)
23 | {
24 | var logger = services.GetRequiredService>();
25 | logger.LogError(ex, "An error occurred seeding the DB.");
26 | }
27 | }
28 | return host;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/Models/TestContext.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore;
2 | using System.ComponentModel.DataAnnotations;
3 | using System.ComponentModel.DataAnnotations.Schema;
4 |
5 | namespace {{ProjectNameSpace}}
6 | {
7 | public class TestContext : DbContext
8 | {
9 | public TestContext(DbContextOptions options) : base(options)
10 | {
11 |
12 | }
13 |
14 | public DbSet TestData { get; set; }
15 | }
16 |
17 | public class TestData
18 | {
19 | [Key]
20 | [DatabaseGenerated(DatabaseGeneratedOption.None)]
21 | public int Id { get; set; }
22 |
23 | public string Data { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/MyCircuitBreakerCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Steeltoe.CircuitBreaker.Hystrix;
6 |
7 | namespace {{ProjectNameSpace}}
8 | {
9 | public class MyCircuitBreakerCommand : HystrixCommand
10 | {
11 | private string _name;
12 | public MyCircuitBreakerCommand(string name): base(HystrixCommandGroupKeyDefault.AsKey("MyCircuitBreakerGroup"))
13 | {
14 | _name = name;
15 | IsFallbackUserDefined = true;
16 | }
17 | protected override async Task RunAsync()
18 | {
19 | return await Task.FromResult("Hello " + _name);
20 | }
21 | protected override async Task RunFallbackAsync()
22 | {
23 | return await Task.FromResult("Hello " + _name + " via fallback");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/templates/Mustache/3.0/netcoreapp3.1/webapi/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | {{#PlaceholderConfig}}
3 | "ResolvedPlaceholderFromEnvVariables": "${PATH?NotFound}",
4 | "UnresolvedPlaceholder": "${SomKeyNotFound?NotFound}",
5 | "ResolvedPlaceholderFromJson": "${Logging:LogLevel:System?${Loggin:LogLevel:Default}}",
6 | {{/PlaceholderConfig}}
7 | "Logging": {
8 | "LogLevel": {
9 | "Default": "Debug",
10 | "System": "Information",
11 | "Microsoft": "Information"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/stylecop.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
3 | "settings": {
4 | "documentationRules": {
5 | "copyrightText": "Copyright {copyrightYear} the original author or authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttps://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
6 | "xmlHeader": false,
7 | "variables": {
8 | "copyrightYear": "2017"
9 | },
10 | "documentExposedElements": false,
11 | "documentInternalElements": false,
12 | "documentPrivateElements": false
13 | },
14 | "indentation": {
15 | "useTabs": false,
16 | "indentationSize": 4
17 | },
18 | "namingRules": {
19 | },
20 | "orderingRules": {
21 | "usingDirectivesPlacement": "outsideNamespace",
22 | "systemUsingDirectivesFirst": false
23 | },
24 | "readabilityRules": {
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.TemplateEngine.Test/ConstantsTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace Steeltoe.Initializr.TemplateEngine.Test
4 | {
5 | public class ConstantsTests
6 | {
7 | [Fact]
8 | public void Steeltoe24()
9 | {
10 | Assert.Equal("2.4.4", Constants.Steeltoe24);
11 | }
12 |
13 | [Fact]
14 | public void Steeltoe30()
15 | {
16 | Assert.Equal("3.0.0", Constants.Steeltoe30);
17 | }
18 |
19 | [Fact]
20 | public void NetCoreApp21()
21 | {
22 | Assert.Equal("netcoreapp2.1", Constants.NetCoreApp21);
23 | }
24 |
25 | [Fact]
26 | public void NetCoreApp31()
27 | {
28 | Assert.Equal("netcoreapp3.1", Constants.NetCoreApp31);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.TemplateEngine.Test/Steeltoe.Initializr.TemplateEngine.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.2
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.TemplateEngine.Test/TestHelper.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using System.Collections.Generic;
16 | using Microsoft.Extensions.Configuration;
17 |
18 | namespace Steeltoe.Initializr.TemplateEngine.Test
19 | {
20 | public class TestHelper
21 | {
22 | public static IConfigurationRoot GetConfiguration()
23 | {
24 | var settings = new Dictionary()
25 | {
26 | ["FriendlyNames:CloudFoundry"] = "Cloud Foundry",
27 | };
28 |
29 | return new ConfigurationBuilder()
30 | .AddInMemoryCollection(settings)
31 | .Build();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.TemplateEngine.Test/XunitLoggerProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Microsoft.Extensions.Logging;
16 | using Xunit.Abstractions;
17 |
18 | namespace Steeltoe.Initializr.TemplateEngine.Test
19 | {
20 | public class XunitLoggerProvider : ILoggerProvider
21 | {
22 | private readonly ITestOutputHelper _testOutputHelper;
23 |
24 | public XunitLoggerProvider(ITestOutputHelper testOutputHelper)
25 | {
26 | _testOutputHelper = testOutputHelper;
27 | }
28 |
29 | public ILogger CreateLogger(string categoryName)
30 | => new XunitLogger(_testOutputHelper, categoryName);
31 |
32 | public void Dispose()
33 | {
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.WebApp.Test/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:62166/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "Steeltoe.Initializr.WebApp.Tests": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:62167/"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.WebApp.Test/Steeltoe.Initializr.WebApp.Test.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.WebApp.Test/Steeltoe.Initializr.WebApp.Test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Steeltoe.Initializr.WebApp.Test
5 |
6 |
7 |
8 |
9 | Controller Tests for multiple templateService implementations.
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.WebApp.Test/TestWebAppFactory.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Microsoft.AspNetCore.Hosting;
16 | using Microsoft.AspNetCore.Mvc.Testing;
17 |
18 | namespace Steeltoe.Initializr.WebApp.Test
19 | {
20 | public class TestWebAppFactory
21 | : WebApplicationFactory
22 | where TStartup : class
23 | {
24 | protected override void ConfigureWebHost(IWebHostBuilder builder)
25 | {
26 | builder.ConfigureServices(services =>
27 | {
28 | });
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/test/Steeltoe.Initializr.WebApp.Test/XunitLoggerProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2017 the original author or authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // https://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | using Microsoft.Extensions.Logging;
16 | using Xunit.Abstractions;
17 |
18 | namespace Steeltoe.Initializr.WebApp.Test
19 | {
20 | public class XunitLoggerProvider : ILoggerProvider
21 | {
22 | private readonly ITestOutputHelper _testOutputHelper;
23 |
24 | public XunitLoggerProvider(ITestOutputHelper testOutputHelper)
25 | {
26 | _testOutputHelper = testOutputHelper;
27 | }
28 |
29 | public ILogger CreateLogger(string categoryName)
30 | => new WebApp.Test.XunitLogger(_testOutputHelper, categoryName);
31 |
32 | public void Dispose()
33 | {
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------