global: add very basic server versioning
This commit is contained in:
1 parent
8730d3fb0b
commit
cb3c8ed4ac
5 files changed
+49
-1
No files matched your search
@@ -226,6 +226,7 @@ namespace Notesnook.API
|
|||||||
app.UseResponseCompression();
|
app.UseResponseCompression();
|
||||||
|
|
||||||
app.UseCors("notesnook");
|
app.UseCors("notesnook");
|
||||||
|
app.UseVersion();
|
||||||
|
|
||||||
app.UseWamp(WampServers.NotesnookServer, (realm, server) =>
|
app.UseWamp(WampServers.NotesnookServer, (realm, server) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using WampSharp.AspNetCore.WebSockets.Server;
|
using WampSharp.AspNetCore.WebSockets.Server;
|
||||||
using WampSharp.Binding;
|
using WampSharp.Binding;
|
||||||
@@ -29,6 +30,18 @@ namespace Streetwriters.Common.Extensions
|
|||||||
{
|
{
|
||||||
public static class AppBuilderExtensions
|
public static class AppBuilderExtensions
|
||||||
{
|
{
|
||||||
|
public static IApplicationBuilder UseVersion(this IApplicationBuilder app)
|
||||||
|
{
|
||||||
|
app.Map("/version", (app) =>
|
||||||
|
{
|
||||||
|
app.Run(async context =>
|
||||||
|
{
|
||||||
|
await context.Response.WriteAsync(Version.AsString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
public static IApplicationBuilder UseWamp<T>(this IApplicationBuilder app, WampServer<T> server, Action<IWampHostedRealm, WampServer<T>> action) where T : new()
|
public static IApplicationBuilder UseWamp<T>(this IApplicationBuilder app, WampServer<T> server, Action<IWampHostedRealm, WampServer<T>> action) where T : new()
|
||||||
{
|
{
|
||||||
WampHost host = new WampHost();
|
WampHost host = new WampHost();
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
This file is part of the Notesnook Sync Server project (https://notesnook.com/)
|
||||||
|
|
||||||
|
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the Affero GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
Affero GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the Affero GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Streetwriters.Common
|
||||||
|
{
|
||||||
|
public class Version
|
||||||
|
{
|
||||||
|
public const int MAJOR = 2;
|
||||||
|
public const int MINOR = 3;
|
||||||
|
public const int PATCH = 0;
|
||||||
|
public static string AsString()
|
||||||
|
{
|
||||||
|
return $"{Version.MAJOR}.{Version.MINOR}.{Version.PATCH}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -177,6 +177,7 @@ namespace Streetwriters.Identity
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseCors("notesnook");
|
app.UseCors("notesnook");
|
||||||
|
app.UseVersion();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of the Notesnook Sync Server project (https://notesnook.com/)
|
This file is part of the Notesnook Sync Server project (https://notesnook.com/)
|
||||||
|
|
||||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||||
@@ -102,6 +102,7 @@ namespace Streetwriters.Messenger
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseCors("notesnook");
|
app.UseCors("notesnook");
|
||||||
|
app.UseVersion();
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user