mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(services): ✨ standup standalone swagger ui instance
This commit is contained in:
parent
1fdcb2ab13
commit
2608dc44a8
13 changed files with 41 additions and 25 deletions
|
|
@ -1,8 +1,7 @@
|
|||
server {
|
||||
listen 80 default_server;
|
||||
|
||||
location ^~ /api/ {
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
location /api/directory {
|
||||
proxy_pass http://directory-api:80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
|
|
@ -12,4 +11,15 @@ server {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://api-docs:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,9 +8,8 @@ server {
|
|||
ssl_certificate_key /etc/nginx/cert/filterlists_key.pem;
|
||||
|
||||
add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; img-src 'self' data:; manifest-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none';" always;
|
||||
|
||||
location ^~ /api/ {
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
|
||||
location /api/directory {
|
||||
proxy_pass http://directory-api:80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
|
|
@ -21,6 +20,17 @@ server {
|
|||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://api-docs:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://web:80;
|
||||
proxy_http_version 1.1;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.6.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FilterLists.Directory.Application;
|
||||
using FilterLists.Directory.Application;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -22,7 +22,7 @@ public void ConfigureServices(IServiceCollection services)
|
|||
services.AddRouting(o => o.LowercaseUrls = true);
|
||||
services.AddControllers()
|
||||
.AddJsonOptions(o => o.JsonSerializerOptions.IgnoreNullValues = true);
|
||||
services.AddSwaggerGen(o => o.CustomSchemaIds(type => type.ToString()));
|
||||
services.AddSwaggerGen();
|
||||
services.AddApplicationServices(Configuration);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -11,6 +11,7 @@ internal static class SwaggerExtensions
|
|||
public static void AddSwaggerGen(this IServiceCollection services)
|
||||
{
|
||||
services.AddSwaggerGen(o =>
|
||||
{
|
||||
o.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Title = "FilterLists Directory API",
|
||||
|
|
@ -24,7 +25,9 @@ public static void AddSwaggerGen(this IServiceCollection services)
|
|||
Name = "MIT License",
|
||||
Url = new Uri("https://github.com/collinbarrett/FilterLists/blob/master/LICENSE")
|
||||
}
|
||||
}));
|
||||
});
|
||||
o.CustomSchemaIds(type => type.ToString());
|
||||
});
|
||||
}
|
||||
|
||||
public static void UseSwagger(this IApplicationBuilder app)
|
||||
|
|
@ -41,13 +44,6 @@ public static void UseSwagger(this IApplicationBuilder app)
|
|||
#endif
|
||||
});
|
||||
});
|
||||
app.UseSwaggerUI(o =>
|
||||
{
|
||||
o.SwaggerEndpoint("v1/swagger.json", "FilterLists Directory API V1");
|
||||
o.DocumentTitle = "FilterLists Directory API";
|
||||
o.RoutePrefix = string.Empty;
|
||||
o.EnableDeepLinking();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
|
|||
|
||||
export const useLanguages = () =>
|
||||
(
|
||||
useApiData<Language[]>("/api/languages") || []
|
||||
useApiData<Language[]>("/api/directory/languages") || []
|
||||
).sort((a: Language, b: Language) => a.name.localeCompare(b.name));
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
|
|||
|
||||
export const useLicenses = () =>
|
||||
(
|
||||
useApiData<License[]>("/api/licenses") || []
|
||||
useApiData<License[]>("/api/directory/licenses") || []
|
||||
).sort((a: License, b: License) => a.name.localeCompare(b.name));
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ import { ListDetails } from "../interfaces/ListDetails";
|
|||
import { useApiData } from "./useApiData";
|
||||
|
||||
export const useListDetails = (id: number) => {
|
||||
return useApiData<ListDetails>("/api/lists/" + id);
|
||||
return useApiData<ListDetails>("/api/directory/lists/" + id);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { List } from "../interfaces/List";
|
|||
import { useApiData } from "./useApiData";
|
||||
|
||||
export const useLists = () => {
|
||||
const lists = useApiData<List[]>("/api/lists");
|
||||
const lists = useApiData<List[]>("/api/directory/lists");
|
||||
lists && lists.forEach((l) => (l.slug = slugify(l.name, SlugifyOptions)));
|
||||
return (lists || []).sort((a: List, b: List) => a.name.localeCompare(b.name));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
|
|||
|
||||
export const useMaintainers = () =>
|
||||
(
|
||||
useApiData<Maintainer[]>("/api/maintainers") || []
|
||||
useApiData<Maintainer[]>("/api/directory/maintainers") || []
|
||||
).sort((a: Maintainer, b: Maintainer) => a.name.localeCompare(b.name));
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ import { useApiData } from "./useApiData";
|
|||
|
||||
export const useSoftware = () =>
|
||||
(
|
||||
useApiData<Software[]>("/api/software") || []
|
||||
useApiData<Software[]>("/api/directory/software") || []
|
||||
).sort((a: Software, b: Software) => a.name.localeCompare(b.name));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ import { Syntax } from "../interfaces/Syntax";
|
|||
import { useApiData } from "./useApiData";
|
||||
|
||||
export const useSyntaxes = () =>
|
||||
(useApiData<Syntax[]>("/api/syntaxes") || []).sort((a: Syntax, b: Syntax) =>
|
||||
(useApiData<Syntax[]>("/api/directory/syntaxes") || []).sort((a: Syntax, b: Syntax) =>
|
||||
a.name.localeCompare(b.name)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ import { Tag } from "../interfaces/Tag";
|
|||
import { useApiData } from "./useApiData";
|
||||
|
||||
export const useTags = () =>
|
||||
(useApiData<Tag[]>("/api/tags") || []).sort((a: Tag, b: Tag) =>
|
||||
(useApiData<Tag[]>("/api/directory/tags") || []).sort((a: Tag, b: Tag) =>
|
||||
a.name.localeCompare(b.name)
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue