aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-02-09 08:47:03 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-02-09 08:47:03 -0600
commitb4760da1b4f6c3eb0f9df99f5914baa272215ec2 (patch)
treec2e477f1270d0a2a0e6db584ca176a774f253b72 /src
parent61c8202ab07d8cec93d0ba03e2910fa823aa2bde (diff)
downloadslskd-b4760da1b4f6c3eb0f9df99f5914baa272215ec2.tar.gz
fix warnings
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Program.cs51
-rw-r--r--src/slskd/Startup.cs74
2 files changed, 88 insertions, 37 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 7c6736a3..2f75c2a0 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -1,5 +1,29 @@
-namespace slskd
+// <copyright file="Program.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd
{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Net;
+ using System.Reflection;
+ using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
@@ -12,13 +36,6 @@
using slskd.Common.Cryptography;
using slskd.Configuration;
using slskd.Validation;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Reflection;
- using System.Security.Cryptography.X509Certificates;
public static class ProgramExtensions
{
@@ -90,9 +107,21 @@
if (ShowHelp || ShowEnvironmentVariables)
{
- if (!NoLogo) PrintLogo(Version);
- if (ShowHelp) PrintCommandLineArguments(Options.Map);
- if (ShowEnvironmentVariables) PrintEnvironmentVariables(Options.Map, EnvironmentVariablePrefix);
+ if (!NoLogo)
+ {
+ PrintLogo(Version);
+ }
+
+ if (ShowHelp)
+ {
+ PrintCommandLineArguments(Options.Map);
+ }
+
+ if (ShowEnvironmentVariables)
+ {
+ PrintEnvironmentVariables(Options.Map, EnvironmentVariablePrefix);
+ }
+
return;
}
diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs
index f093fa67..41ef747c 100644
--- a/src/slskd/Startup.cs
+++ b/src/slskd/Startup.cs
@@ -1,41 +1,56 @@
-namespace slskd
+// <copyright file="Startup.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd
{
using System;
+ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
- using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
+ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
- using Microsoft.OpenApi.Models;
- using Soulseek;
- using Soulseek.Diagnostics;
- using slskd.Trackers;
- using System.Collections.Concurrent;
+ using Microsoft.Extensions.FileProviders;
using Microsoft.IdentityModel.Tokens;
- using slskd.Security;
- using Microsoft.AspNetCore.Authentication.JwtBearer;
+ using Microsoft.OpenApi.Models;
+ using Prometheus;
using Prometheus.SystemMetrics;
using Serilog;
- using Prometheus;
- using Microsoft.Extensions.FileProviders;
using Serilog.Events;
using slskd.Entities;
- using slskd.Configuration;
+ using slskd.Security;
+ using slskd.Trackers;
+ using Soulseek;
+ using Soulseek.Diagnostics;
public class Startup
{
private readonly int MaxReconnectAttempts = 3;
private int CurrentReconnectAttempts = 0;
- private static readonly string XmlDocFile = Path.Combine(AppContext.BaseDirectory, typeof(Startup).GetTypeInfo().Assembly.GetName().Name + ".xml");
+ private static readonly string XmlDocFile = Path.Combine(AppContext.BaseDirectory, Program.AppName + ".xml");
private SoulseekClient Client { get; set; }
private ISharedFileCache SharedFileCache { get; set; }
@@ -125,22 +140,29 @@
options.SubstituteApiVersionInUrl = true;
});
- services.AddSwaggerGen(options =>
+ if (Options.Feature.Swagger)
{
- options.DescribeAllParametersInCamelCase();
- options.SwaggerDoc("v0",
- new OpenApiInfo
+ services.AddSwaggerGen(options =>
+ {
+ options.DescribeAllParametersInCamelCase();
+ options.SwaggerDoc("v0",
+ new OpenApiInfo
+ {
+ Title = "slskd",
+ Version = "v0"
+ }
+ );
+
+ if (System.IO.File.Exists(XmlDocFile))
{
- Title = "slskd",
- Version = "v0"
+ options.IncludeXmlComments(XmlDocFile);
}
- );
-
- if (System.IO.File.Exists(XmlDocFile))
- {
- options.IncludeXmlComments(XmlDocFile);
- }
- });
+ else
+ {
+ logger.Warning($"Unable to find XML documentation in {XmlDocFile}, Swagger will not include metadata");
+ }
+ });
+ }
if (Options.Feature.Prometheus)
{