Browse Source

Swagger improved.

pull/194/head
Sebastian Stehle 9 years ago
parent
commit
f39c83ef11
  1. 1
      src/Squidex/AppServices.cs
  2. 2
      src/Squidex/Areas/Api/Config/Swagger/SwaggerServices.cs
  3. 2
      src/Squidex/Areas/Api/Config/Swagger/XmlResponseTypesProcessor.cs
  4. 1
      src/Squidex/Areas/Api/Controllers/ApiController.cs
  5. 27
      src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs
  6. 20
      src/Squidex/Areas/Api/Views/Shared/Docs.cshtml
  7. 44
      src/Squidex/Areas/OrleansDashboard/Middlewares/OrleansDashboardAuthenticationMiddleware.cs
  8. 28
      src/Squidex/Areas/OrleansDashboard/Startup.cs
  9. 41
      src/Squidex/Config/Domain/PubSubServices.cs
  10. 29
      src/Squidex/Config/Domain/ReadServices.cs
  11. 6
      src/Squidex/Config/Domain/StoreServices.cs
  12. 57
      src/Squidex/Config/Orleans/ClientServices.cs
  13. 22
      src/Squidex/Config/Orleans/CustomJsonSerializer.cs
  14. 23
      src/Squidex/Config/Orleans/CustomMongoDbStorageProvider.cs
  15. 43
      src/Squidex/Config/Orleans/SiloExtensions.cs
  16. 89
      src/Squidex/Config/Orleans/SiloServices.cs
  17. 2
      src/Squidex/Pipeline/Swagger/SwaggerHelper.cs
  18. 61
      src/Squidex/Program.cs
  19. 4
      src/Squidex/Squidex.csproj
  20. 6
      src/Squidex/WebStartup.cs
  21. 35
      src/Squidex/appsettings.json
  22. 3
      src/Squidex/package.json

1
src/Squidex/AppServices.cs

@ -32,6 +32,7 @@ namespace Squidex
services.AddMyIdentityServer();
services.AddMyInfrastructureServices(config);
services.AddMyMvc();
services.AddMyPubSubServices(config);
services.AddMyReadServices(config);
services.AddMySerializers();
services.AddMyStoreServices(config);

2
src/Squidex/Areas/Api/Config/Swagger/SwaggerServices.cs

@ -30,7 +30,7 @@ namespace Squidex.Areas.Api.Config.Swagger
var urlOptions = s.GetService<IOptions<MyUrlsOptions>>().Value;
var settings =
new SwaggerSettings { Title = "Squidex API Specification", IsAspNetCore = false }
new SwaggerSettings { Title = "Squidex API", Version = "1.0", IsAspNetCore = false }
.ConfigurePaths(urlOptions)
.ConfigureSchemaSettings()
.ConfigureIdentity(urlOptions);

2
src/Squidex/Areas/Api/Config/Swagger/XmlResponseTypesProcessor.cs

@ -21,7 +21,7 @@ namespace Squidex.Areas.Api.Config.Swagger
{
public sealed class XmlResponseTypesProcessor : IOperationProcessor
{
private static readonly Regex ResponseRegex = new Regex("(?<Code>[0-9]{3}) => (?<Description>.*)", RegexOptions.Compiled);
private static readonly Regex ResponseRegex = new Regex("(?<Code>[0-9]{3}) =&gt; (?<Description>.*)", RegexOptions.Compiled);
public async Task<bool> ProcessAsync(OperationProcessorContext context)
{

1
src/Squidex/Areas/Api/Controllers/ApiController.cs

@ -16,6 +16,7 @@ using Squidex.Pipeline;
namespace Squidex.Areas.Api.Controllers
{
[Area("Api")]
public abstract class ApiController : Controller
{
protected ICommandBus CommandBus { get; }

27
src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs

@ -6,14 +6,15 @@
// All rights reserved.
// ==========================================================================
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using Orleans;
using Squidex.Areas.Api.Controllers.EventConsumers.Models;
using Squidex.Infrastructure;
using Squidex.Infrastructure.CQRS.Commands;
using Squidex.Infrastructure.CQRS.Events.Orleans.Grains;
using Squidex.Infrastructure.CQRS.Events.Actors.Messages;
using Squidex.Infrastructure.Reflection;
using Squidex.Pipeline;
@ -25,12 +26,12 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers
[SwaggerIgnore]
public sealed class EventConsumersController : ApiController
{
private readonly IEventConsumerRegistryGrain eventConsumerRegistryGrain;
private readonly IPubSub pubSub;
public EventConsumersController(ICommandBus commandBus, IClusterClient orleans)
public EventConsumersController(ICommandBus commandBus, IPubSub pubSub)
: base(commandBus)
{
eventConsumerRegistryGrain = orleans.GetGrain<IEventConsumerRegistryGrain>("Default");
this.pubSub = pubSub;
}
[HttpGet]
@ -38,9 +39,9 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers
[ApiCosts(0)]
public async Task<IActionResult> GetEventConsumers()
{
var entities = await eventConsumerRegistryGrain.GetConsumersAsync();
var entities = await pubSub.RequestAsync<GetStatesRequest, GetStatesResponse>(new GetStatesRequest(), TimeSpan.FromSeconds(2), true);
var models = entities.Value.Select(x => SimpleMapper.Map(x, new EventConsumerDto())).ToList();
var models = entities.States.Select(x => SimpleMapper.Map(x, new EventConsumerDto())).ToList();
return Ok(models);
}
@ -48,9 +49,9 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers
[HttpPut]
[Route("event-consumers/{name}/start/")]
[ApiCosts(0)]
public async Task<IActionResult> Start(string name)
public IActionResult Start(string name)
{
await eventConsumerRegistryGrain.StartAsync(name);
pubSub.Publish(new StartConsumerMessage { ConsumerName = name }, true);
return NoContent();
}
@ -58,9 +59,9 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers
[HttpPut]
[Route("event-consumers/{name}/stop/")]
[ApiCosts(0)]
public async Task<IActionResult> Stop(string name)
public IActionResult Stop(string name)
{
await eventConsumerRegistryGrain.StopAsync(name);
pubSub.Publish(new StopConsumerMessage { ConsumerName = name }, true);
return NoContent();
}
@ -68,9 +69,9 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers
[HttpPut]
[Route("event-consumers/{name}/reset/")]
[ApiCosts(0)]
public async Task<IActionResult> Reset(string name)
public IActionResult Reset(string name)
{
await eventConsumerRegistryGrain.ResetAsync(name);
pubSub.Publish(new ResetConsumerMessage { ConsumerName = name }, true);
return NoContent();
}

20
src/Squidex/Areas/Api/Views/Shared/Docs.cshtml

@ -9,32 +9,16 @@
<head>
<title>API Docs</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { margin: 0; padding: 0; }
h1,
.menu-header,
.menu-cat-header:hover,
.menu-cat-header.active,
.menu-item-depth-1 > .menu-item-header:not(.disabled):hover,
.menu-item-depth-1.active > .menu-item-header {
color: #3f83df !important;
}
.method-content a {
color: #3d7dd5 !important;
}
.redoc-markdown-block code {
color: #ffffff !important;
}
</style>
</head>
<body>
<redoc spec-url="@Url.Content(Model.Specification)"></redoc>
<script src="~/scripts/redoc.min.js"></script>
<script src="https://unpkg.com/redoc@2.0.0-alpha.3/bundles/redoc.standalone.js"></script>
</body>
</html>

44
src/Squidex/Areas/OrleansDashboard/Middlewares/OrleansDashboardAuthenticationMiddleware.cs

@ -1,44 +0,0 @@
// ==========================================================================
// LazyClientStore.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Http;
using Squidex.Shared.Identity;
namespace Squidex.Areas.OrleansDashboard.Middlewares
{
public sealed class OrleansDashboardAuthenticationMiddleware
{
private readonly RequestDelegate next;
public OrleansDashboardAuthenticationMiddleware(RequestDelegate next)
{
this.next = next;
}
public async Task Invoke(HttpContext context)
{
var authentication = await context.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme);
if (!authentication.Succeeded || !authentication.Principal.IsInRole(SquidexRoles.Administrator))
{
await context.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties
{
RedirectUri = context.Request.PathBase + context.Request.Path
});
}
else
{
await next(context);
}
}
}
}

28
src/Squidex/Areas/OrleansDashboard/Startup.cs

@ -1,28 +0,0 @@
// ==========================================================================
// Startup.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Microsoft.AspNetCore.Builder;
using Orleans;
using Squidex.Areas.OrleansDashboard.Middlewares;
using Squidex.Config;
namespace Squidex.Areas.OrleansDashboard
{
public static class Startup
{
public static void ConfigureOrleansDashboard(this IApplicationBuilder app)
{
app.Map(Constants.OrleansPrefix, orleansApp =>
{
orleansApp.UseAuthentication();
orleansApp.UseMiddleware<OrleansDashboardAuthenticationMiddleware>();
orleansApp.UseOrleansDashboard();
});
}
}
}

41
src/Squidex/Config/Domain/PubSubServices.cs

@ -0,0 +1,41 @@
// ==========================================================================
// PubSubServices.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Log;
using StackExchange.Redis;
namespace Squidex.Config.Domain
{
public static class PubSubServices
{
public static void AddMyPubSubServices(this IServiceCollection services, IConfiguration config)
{
config.ConfigureByOption("pubSub:type", new Options
{
["InMemory"] = () =>
{
services.AddSingletonAs<InMemoryPubSub>()
.As<IPubSub>();
},
["Redis"] = () =>
{
var configuration = config.GetRequiredValue("pubsub:redis:configuration");
var redis = Singletons<IConnectionMultiplexer>.GetOrAddLazy(configuration, s => ConnectionMultiplexer.Connect(s));
services.AddSingletonAs(c => new RedisPubSub(redis, c.GetRequiredService<ISemanticLog>()))
.As<IPubSub>()
.As<IExternalSystem>();
}
});
}
}
}

29
src/Squidex/Config/Domain/ReadServices.cs

@ -25,11 +25,13 @@ using Squidex.Domain.Apps.Read.History;
using Squidex.Domain.Apps.Read.Rules;
using Squidex.Domain.Apps.Read.Schemas;
using Squidex.Domain.Apps.Read.State.Orleans;
using Squidex.Domain.Apps.Read.State.Orleans.Grains;
using Squidex.Domain.Users;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Assets;
using Squidex.Infrastructure.CQRS.Events;
using Squidex.Infrastructure.CQRS.Events.Orleans;
using Squidex.Infrastructure.CQRS.Events.Actors;
using Squidex.Infrastructure.States;
using Squidex.Pipeline;
namespace Squidex.Config.Domain
@ -38,6 +40,18 @@ namespace Squidex.Config.Domain
{
public static void AddMyReadServices(this IServiceCollection services, IConfiguration config)
{
var consumeEvents = config.GetOptionalValue("eventStore:consume", false);
if (consumeEvents)
{
services.AddTransient<EventConsumerActor>();
services.AddSingletonAs<EventConsumerActorManager>()
.As<IExternalSystem>();
services.AddSingletonAs<RuleDequeuer>()
.As<IExternalSystem>();
}
var exposeSourceUrl = config.GetOptionalValue("assetStore:exposeSourceUrl", true);
services.AddSingletonAs(c => new GraphQLUrlGenerator(
@ -72,10 +86,10 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<NoopAppPlanBillingManager>()
.As<IAppPlanBillingManager>();
services.AddSingletonAs<OrleansEventNotifier>()
services.AddSingletonAs<DefaultEventNotifier>()
.As<IEventNotifier>();
services.AddSingletonAs<OrleansAppProvider>()
services.AddSingletonAs<AppProvider>()
.As<IAppProvider>();
services.AddSingletonAs<AppStateEventConsumer>()
@ -84,6 +98,9 @@ namespace Squidex.Config.Domain
services.AddSingletonAs<RuleEnqueuer>()
.As<IEventConsumer>();
services.AddSingletonAs<StateFactory>()
.As<IStateFactory>();
services.AddSingletonAs<ContentChangedTriggerHandler>()
.As<IRuleTriggerHandler>();
@ -100,8 +117,12 @@ namespace Squidex.Config.Domain
return new EventConsumerFactory(n => allEventConsumers.FirstOrDefault(x => x.Name == n));
});
services.AddSingletonAs<RuleService>();
services.AddSingletonAs<EdmModelBuilder>();
services.AddTransient<AppStateGrain>();
services.AddTransient<AppUserGrain>();
services.AddSingleton<RuleService>();
}
}
}

6
src/Squidex/Config/Domain/StoreServices.cs

@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Driver;
using Newtonsoft.Json;
using Squidex.Domain.Apps.Read;
using Squidex.Domain.Apps.Read.Assets;
using Squidex.Domain.Apps.Read.Assets.Repositories;
@ -28,6 +29,7 @@ using Squidex.Domain.Users.MongoDb;
using Squidex.Domain.Users.MongoDb.Infrastructure;
using Squidex.Infrastructure;
using Squidex.Infrastructure.CQRS.Events;
using Squidex.Infrastructure.States;
using Squidex.Infrastructure.UsageTracking;
using Squidex.Shared.Users;
@ -53,6 +55,10 @@ namespace Squidex.Config.Domain
.As<IXmlRepository>()
.As<IExternalSystem>();
services.AddSingletonAs(c => new MongoStateStore(mongoDatabase, c.GetRequiredService<JsonSerializer>()))
.As<IStateStore>()
.As<IExternalSystem>();
services.AddSingletonAs(c => new MongoUserStore(mongoDatabase))
.As<IUserStore<IUser>>()
.As<IUserFactory>()

57
src/Squidex/Config/Orleans/ClientServices.cs

@ -1,57 +0,0 @@
// ==========================================================================
// ClientServices.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Orleans;
using Orleans.Runtime.Configuration;
using Squidex.Domain.Apps.Read.State.Orleans.Grains.Implementations;
using Squidex.Infrastructure.CQRS.Events.Orleans.Grains.Implementation;
namespace Squidex.Config.Orleans
{
public static class ClientServices
{
public static void AddAppClient(this IServiceCollection services)
{
services.AddSingletonAs(c => c.GetRequiredService<IClusterClient>())
.As<IGrainFactory>();
services.AddServicesForSelfHostedDashboard(null, options =>
{
options.HideTrace = true;
});
services.AddSingletonAs(c =>
{
var client = new ClientBuilder()
.UseConfiguration(ClientConfiguration.LocalhostSilo().WithJsonSerializer())
.UseDashboard()
.AddApplicationPartsFromReferences(typeof(AppStateGrain).Assembly)
.AddApplicationPartsFromReferences(typeof(EventConsumerGrain).Assembly)
.UseStaticGatewayListProvider(options =>
{
options.Gateways.Add(new Uri("gwy.tcp://127.0.0.1:40000/0"));
})
.Build();
client.Connect().Wait();
return client;
});
}
public static ClientConfiguration WithJsonSerializer(this ClientConfiguration config)
{
config.SerializationProviders.Add(typeof(CustomJsonSerializer).GetTypeInfo());
return config;
}
}
}

22
src/Squidex/Config/Orleans/CustomJsonSerializer.cs

@ -1,22 +0,0 @@
// ==========================================================================
// CustomJsonSerializer.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Newtonsoft.Json;
using Squidex.Config.Domain;
using Squidex.Infrastructure.Json.Orleans;
namespace Squidex.Config.Orleans
{
public class CustomJsonSerializer : JsonExternalSerializer
{
public CustomJsonSerializer()
: base(JsonSerializer.Create(SerializationServices.DefaultJsonSettings))
{
}
}
}

23
src/Squidex/Config/Orleans/CustomMongoDbStorageProvider.cs

@ -1,23 +0,0 @@
// ==========================================================================
// CustomMongoDbStorageProvider.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Newtonsoft.Json;
using Orleans.Providers;
using Orleans.Providers.MongoDB.StorageProviders;
using Squidex.Config.Domain;
namespace Squidex.Config.Orleans
{
public sealed class CustomMongoDbStorageProvider : MongoStorageProvider
{
protected override JsonSerializerSettings ReturnSerializerSettings(IProviderRuntime providerRuntime, IProviderConfiguration config)
{
return SerializationServices.DefaultJsonSettings;
}
}
}

43
src/Squidex/Config/Orleans/SiloExtensions.cs

@ -1,43 +0,0 @@
// ==========================================================================
// SiloExtensions.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Orleans;
using Orleans.Hosting;
using Orleans.Runtime.Configuration;
namespace Squidex.Config.Orleans
{
public static class SiloExtensions
{
public static ISiloHostBuilder UseContentRoot(this ISiloHostBuilder builder, string path)
{
builder.ConfigureAppConfiguration(config =>
{
config.SetBasePath(path);
});
return builder;
}
public static ClusterConfiguration WithJsonSerializer(this ClusterConfiguration config)
{
config.Globals.SerializationProviders.Add(typeof(CustomJsonSerializer).GetTypeInfo());
return config;
}
public static ClusterConfiguration WithDashboard(this ClusterConfiguration config)
{
config.RegisterDashboard();
return config;
}
}
}

89
src/Squidex/Config/Orleans/SiloServices.cs

@ -1,89 +0,0 @@
// ==========================================================================
// SiloServices.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
using System.Linq;
using System.Net;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Orleans;
using Orleans.Runtime.Configuration;
using Squidex.Domain.Apps.Read.Rules.Orleans;
using Squidex.Infrastructure.CQRS.Events.Orleans.Grains;
namespace Squidex.Config.Orleans
{
public static class SiloServices
{
public static void AddAppSiloServices(this IServiceCollection services, IConfiguration config)
{
var clusterConfiguration =
services.Where(x => x.ServiceType == typeof(ClusterConfiguration))
.Select(x => x.ImplementationInstance)
.Select(x => (ClusterConfiguration)x)
.FirstOrDefault();
if (clusterConfiguration != null)
{
clusterConfiguration.Globals.RegisterBootstrapProvider<EventConsumerBootstrap>("EventConsumers");
clusterConfiguration.Globals.RegisterBootstrapProvider<RuleDequeuerBootstrap>("RuleDequeuer");
var ipConfig = config.GetRequiredValue("orleans:hostNameOrIPAddress");
if (ipConfig.Equals("Host", StringComparison.OrdinalIgnoreCase))
{
ipConfig = Dns.GetHostName();
}
else if (ipConfig.Equals("FirstIPAddressOfHost"))
{
var ips = Dns.GetHostAddressesAsync(Dns.GetHostName()).Result;
ipConfig = ips.FirstOrDefault()?.ToString();
}
clusterConfiguration.Defaults.PropagateActivityId = true;
clusterConfiguration.Defaults.ProxyGatewayEndpoint = new IPEndPoint(IPAddress.Any, 40000);
clusterConfiguration.Defaults.HostNameOrIPAddress = ipConfig;
}
config.ConfigureByOption("store:type", new Options
{
["MongoDB"] = () =>
{
var mongoConfiguration = config.GetRequiredValue("store:mongoDb:configuration");
var mongoDatabaseName = config.GetRequiredValue("store:mongoDb:database");
if (clusterConfiguration != null)
{
clusterConfiguration.AddMongoDBStorageProvider<CustomMongoDbStorageProvider>("Default", c =>
{
c.ConnectionString = mongoConfiguration;
c.CollectionPrefix = "States_";
c.DatabaseName = mongoDatabaseName;
c.UseJsonFormat = true;
});
}
services.AddMongoDBMembershipTable(c =>
{
c.ConnectionString = mongoConfiguration;
c.CollectionPrefix = "Orleans_";
c.DatabaseName = mongoDatabaseName;
});
services.AddMongoDBReminders(c =>
{
c.ConnectionString = mongoConfiguration;
c.CollectionPrefix = "Orleans_";
c.DatabaseName = mongoDatabaseName;
});
}
});
}
}
}

2
src/Squidex/Pipeline/Swagger/SwaggerHelper.cs

@ -63,7 +63,7 @@ namespace Squidex.Pipeline.Swagger
{
["x-logo"] = new { url = urlOptions.BuildUrl("images/logo-white.png", false), backgroundColor = "#3f83df" }
},
Title = $"Suidex API for {appName} App"
Title = $"Squidex API for {appName} App", Version = "1.0"
},
BasePath = "/api"
};

61
src/Squidex/Program.cs

@ -6,15 +6,8 @@
// All rights reserved.
// ==========================================================================
using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Orleans;
using Orleans.Hosting;
using Orleans.Runtime.Configuration;
using Squidex.Config.Orleans;
using Squidex.Domain.Apps.Read.State.Orleans.Grains.Implementations;
using Squidex.Infrastructure.CQRS.Events.Orleans.Grains.Implementation;
using Squidex.Infrastructure.Log.Adapter;
namespace Squidex
@ -23,61 +16,21 @@ namespace Squidex
{
public static void Main(string[] args)
{
var silo = new SiloHostBuilder()
.AddApplicationPartsFromReferences(typeof(AppStateGrain).Assembly)
.AddApplicationPartsFromReferences(typeof(EventConsumerGrain).Assembly)
.UseDashboard(options => { options.HostSelf = false; })
new WebHostBuilder()
.UseKestrel(k => { k.AddServerHeader = false; })
.UseContentRoot(Directory.GetCurrentDirectory())
.UseConfiguration(
ClusterConfiguration.LocalhostPrimarySilo(33333)
.WithJsonSerializer()
.WithDashboard())
.ConfigureServices((context, services) =>
{
services.AddAppSiloServices(context.Configuration);
services.AddAppServices(context.Configuration);
})
.UseIISIntegration()
.UseStartup<WebStartup>()
.ConfigureLogging(builder =>
{
builder.AddSemanticLog();
})
.ConfigureAppConfiguration((hostContext, builder) =>
{
builder.AddAppConfiguration(GetEnvironment(), args);
builder.AddAppConfiguration(hostContext.HostingEnvironment.EnvironmentName, args);
})
.Build();
silo.StartAsync().Wait();
try
{
new WebHostBuilder()
.UseKestrel(k => { k.AddServerHeader = false; })
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<WebStartup>()
.ConfigureLogging(builder =>
{
builder.AddSemanticLog();
})
.ConfigureAppConfiguration((hostContext, builder) =>
{
builder.AddAppConfiguration(hostContext.HostingEnvironment.EnvironmentName, args);
})
.Build()
.Run();
}
finally
{
silo.StopAsync().Wait();
}
}
private static string GetEnvironment()
{
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
return environment ?? "Development";
.Build()
.Run();
}
}
}

4
src/Squidex/Squidex.csproj

@ -49,7 +49,7 @@
<ItemGroup>
<PackageReference Include="EventStore.ClientAPI.NetCore" Version="4.0.2-rc" />
<PackageReference Include="IdentityServer4" Version="2.0.3" />
<PackageReference Include="IdentityServer4" Version="2.0.4" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.1.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
@ -72,8 +72,6 @@
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="2.0.0" />
<PackageReference Include="NSwag.AspNetCore" Version="11.12.9" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="Orleans.Providers.MongoDB" Version="2.0.0-preview2" />
<PackageReference Include="OrleansDashboard" Version="2.0.0-beta3" />
<PackageReference Include="RefactoringEssentials" Version="5.4.0" />
<PackageReference Include="ReportGenerator" Version="3.0.2" />
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.6" />

6
src/Squidex/WebStartup.cs

@ -14,15 +14,13 @@ using Microsoft.Extensions.DependencyInjection;
using Squidex.Areas.Api;
using Squidex.Areas.Frontend;
using Squidex.Areas.IdentityServer;
using Squidex.Areas.OrleansDashboard;
using Squidex.Areas.Portal;
using Squidex.Config.Domain;
using Squidex.Config.Orleans;
using Squidex.Config.Web;
namespace Squidex
{
public class WebStartup : IStartup
public sealed class WebStartup : IStartup
{
private readonly IConfiguration configuration;
@ -33,7 +31,6 @@ namespace Squidex
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddAppClient();
services.AddAppServices(configuration);
return services.BuildServiceProvider();
@ -49,7 +46,6 @@ namespace Squidex
app.UseMyTracking();
app.ConfigureApi();
app.ConfigureOrleansDashboard();
app.ConfigurePortal();
app.ConfigureIdentityServer();

35
src/Squidex/appsettings.json

@ -29,6 +29,26 @@
"human": true
},
/*
* The pub sub mechanmism distributes messages between the nodes.
*/
"pubSub": {
/*
* Define the type of the read store.
*
* Supported: InMemory (for single node only), Redis (for cluster)
*/
"type": "InMemory",
"redis": {
/*
* Connection string to your redis server.
*
* Read More: https://github.com/ServiceStack/ServiceStack.Redis#redis-connection-strings
*/
"configuration": "localhost:6379,resolveDns=1"
}
},
"assetStore": {
/*
* Define the type of the read store.
@ -64,15 +84,6 @@
"exposeSourceUrl": false
},
"orleans": {
/*
* Define the IP address or host name that is used for inter-silo communication.
*
* Special values: FirstIPAddressOfHost, Host
*/
"hostNameOrIPAddress": "localhost"
},
"eventStore": {
/*
* Define the type of the event store.
@ -107,7 +118,11 @@
* Prefix for all streams and projections (for multiple installations).
*/
"prefix": "squidex"
}
},
/*
* Consume the events on this server (Ensure that it is only enabled on a single node).
*/
"consume": true
},
"eventPublishers": {

3
src/Squidex/package.json

@ -11,7 +11,7 @@
"dev": "cpx node_modules/oidc-client/dist/oidc-client.min.js wwwroot/scripts/ & cpx node_modules/redoc/dist/redoc.min.js wwwroot/scripts/ && webpack-dev-server --config app-config/webpack.run.dev.js --inline --port 3000",
"build": "webpack --config app-config/webpack.run.prod.js --display-error-details --bail",
"build:nobail": "webpack --config app-config/webpack.run.prod.js --display-error-details",
"build:copy": "cpx node_modules/oidc-client/dist/oidc-client.min.js wwwroot/scripts/ & cpx node_modules/redoc/dist/redoc.min.js wwwroot/scripts/",
"build:copy": "cpx node_modules/oidc-client/dist/oidc-client.min.js wwwroot/scripts/",
"build:clean": "rimraf wwwroot/build"
},
"dependencies": {
@ -38,7 +38,6 @@
"progressbar.js": "1.0.1",
"react": "16.0.0",
"react-dom": "16.0.0",
"redoc": "1.19.1",
"rxjs": "5.5.2",
"zone.js": "0.8.18"
},

Loading…
Cancel
Save