Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ RUN ln -s /bin/echo /bin/systemctl \
&& wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add - \
&& echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list

# Install Swashbuckle CLI Tool to generate swagger file
RUN dotnet tool install --global Swashbuckle.AspNetCore.Cli --version 6.3.0
ENV PATH="${PATH}:/root/.dotnet/tools"

RUN apt-get update \
&& apt-get install -qqy --no-install-recommends mongodb-org=5.0.1

Expand All @@ -21,6 +25,17 @@ RUN mkdir /data \
RUN mongod --fork --logpath /var/log/mongod.log \
&& ./build.sh --target Test Compile --configuration Release

# Create Swagger file
RUN swagger tofile --basepath https://universalis.app/ --serializeasv2 --output /source/swagger.json /source/artifacts/Universalis.Application.dll v2

FROM swaggerapi/swagger-codegen-cli:latest
WORKDIR /clients
COPY --from=build-env /source/swagger.json /clients/swagger.json

# Create clients
RUN swagger-codegen generate -l python -o /clients/python -i /clients/swagger.json
RUN swagger-codegen generate -l javascript -o /clients/javascript -i /clients/swagger.json

# Run stage
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
Expand Down
7 changes: 5 additions & 2 deletions src/Universalis.Application/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ public void ConfigureServices(IServiceCollection services)

services.AddAllOfType<IUploadBehavior>(new[] { typeof(Startup).Assembly }, ServiceLifetime.Singleton);

var cacheSize = int.Parse(Configuration["MarketCurrentDataCacheSize"]);
services.AddSingleton<ICache<CurrentlyShownQuery, CurrentlyShownView>>(new MemoryCache<CurrentlyShownQuery, CurrentlyShownView>(cacheSize));

services.AddSingleton<ICache<CurrentlyShownQuery, CurrentlyShownView>>(_ => {
var cacheSize = int.Parse(Configuration["MarketCurrentDataCacheSize"]);
return new MemoryCache<CurrentlyShownQuery, CurrentlyShownView>(cacheSize);
});

services
.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
Expand Down
2 changes: 1 addition & 1 deletion src/Universalis.DbAccess/DbAccessExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class DbAccessExtensions
{
public static void AddDbAccessServices(this IServiceCollection sc, IConfiguration configuration)
{
sc.AddSingleton<IMongoClient>(new MongoClient(configuration["MongoDbConnectionString"]));
sc.AddSingleton<IMongoClient>(_ => new MongoClient(configuration["MongoDbConnectionString"]));

sc.AddSingleton<IMostRecentlyUpdatedDbAccess, MostRecentlyUpdatedDbAccess>();
sc.AddSingleton<ICurrentlyShownDbAccess, CurrentlyShownDbAccess>();
Expand Down