Skip to content

Commit cef1a99

Browse files
committed
wip: complete refactor, Observer -> Aggregators
1 parent ac54678 commit cef1a99

27 files changed

+514
-534
lines changed

.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

.gitignore

+35-10
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@
1313
# User-specific files (MonoDevelop/Xamarin Studio)
1414
*.userprefs
1515

16+
# Mono auto generated files
17+
mono_crash.*
18+
1619
# Build results
1720
[Dd]ebug/
1821
[Dd]ebugPublic/
1922
[Rr]elease/
2023
[Rr]eleases/
2124
x64/
2225
x86/
26+
[Ww][Ii][Nn]32/
2327
[Aa][Rr][Mm]/
2428
[Aa][Rr][Mm]64/
2529
bld/
2630
[Bb]in/
2731
[Oo]bj/
2832
[Ll]og/
33+
[Ll]ogs/
2934

3035
# Visual Studio 2015/2017 cache/options directory
3136
.vs/
@@ -39,9 +44,10 @@ Generated\ Files/
3944
[Tt]est[Rr]esult*/
4045
[Bb]uild[Ll]og.*
4146

42-
# NUNIT
47+
# NUnit
4348
*.VisualState.xml
4449
TestResult.xml
50+
nunit-*.xml
4551

4652
# Build Results of an ATL Project
4753
[Dd]ebugPS/
@@ -56,6 +62,9 @@ project.lock.json
5662
project.fragment.lock.json
5763
artifacts/
5864

65+
# ASP.NET Scaffolding
66+
ScaffoldingReadMe.txt
67+
5968
# StyleCop
6069
StyleCopReport.xml
6170

@@ -122,9 +131,6 @@ _ReSharper*/
122131
*.[Rr]e[Ss]harper
123132
*.DotSettings.user
124133

125-
# JustCode is a .NET coding add-in
126-
.JustCode
127-
128134
# TeamCity is a build add-in
129135
_TeamCity*
130136

@@ -135,6 +141,11 @@ _TeamCity*
135141
.axoCover/*
136142
!.axoCover/settings.json
137143

144+
# Coverlet is a free, cross platform Code Coverage Tool
145+
coverage*.json
146+
coverage*.xml
147+
coverage*.info
148+
138149
# Visual Studio code coverage results
139150
*.coverage
140151
*.coveragexml
@@ -182,6 +193,8 @@ PublishScripts/
182193

183194
# NuGet Packages
184195
*.nupkg
196+
# NuGet Symbol Packages
197+
*.snupkg
185198
# The packages folder can be ignored because of Package Restore
186199
**/[Pp]ackages/*
187200
# except build/, which is used as an MSBuild target.
@@ -206,6 +219,8 @@ BundleArtifacts/
206219
Package.StoreAssociation.xml
207220
_pkginfo.txt
208221
*.appx
222+
*.appxbundle
223+
*.appxupload
209224

210225
# Visual Studio cache files
211226
# files ending in .cache can be ignored
@@ -255,7 +270,9 @@ ServiceFabricBackup/
255270
*.bim.layout
256271
*.bim_*.settings
257272
*.rptproj.rsuser
258-
*- Backup*.rdl
273+
*- [Bb]ackup.rdl
274+
*- [Bb]ackup ([0-9]).rdl
275+
*- [Bb]ackup ([0-9][0-9]).rdl
259276

260277
# Microsoft Fakes
261278
FakesAssemblies/
@@ -291,10 +308,6 @@ paket-files/
291308
# FAKE - F# Make
292309
.fake/
293310

294-
# JetBrains Rider
295-
.idea/
296-
*.sln.iml
297-
298311
# CodeRush personal settings
299312
.cr/personal
300313

@@ -337,4 +350,16 @@ ASALocalRun/
337350
.localhistory/
338351

339352
# BeatPulse healthcheck temp database
340-
healthchecksdb
353+
healthchecksdb
354+
355+
# Backup folder for Package Reference Convert tool in Visual Studio 2017
356+
MigrationBackup/
357+
358+
# Ionide (cross platform F# VS Code tools) working folder
359+
.ionide/
360+
361+
# Fody - auto-generated XML schema
362+
FodyWeavers.xsd
363+
364+
#IDE metadata
365+
**.idea/**

Constants.cs

-44
This file was deleted.

Dockerfile

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
44
WORKDIR /app
5+
EXPOSE 80
6+
EXPOSE 443
57

68
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
79
WORKDIR /src
8-
COPY ["OSItemIndex.Observer/OSItemIndex.Observer.csproj", "OSItemIndex.Observer/"]
9-
COPY ["OSItemIndex.API/OSItemIndex.API.csproj", "OSItemIndex.API/"]
10-
RUN dotnet restore "OSItemIndex.Observer/OSItemIndex.Observer.csproj"
11-
COPY . .
12-
WORKDIR "/src/OSItemIndex.Observer"
13-
RUN dotnet build "OSItemIndex.Observer.csproj" -c Release -o /app/build
10+
COPY *.sln .
11+
COPY OSItemIndex.Aggregator.OSRSBox/*.csproj ./OSItemIndex.Aggregator.OSRSBox/
12+
COPY OSItemIndex.AggregateService/*.csproj ./OSItemIndex.AggregateService/
13+
COPY OSItemIndex.API/*.csproj ./OSItemIndex.API/
14+
RUN dotnet restore
15+
16+
COPY OSItemIndex.Aggregator.OSRSBox/. ./OSItemIndex.Aggregator.OSRSBox/
17+
COPY OSItemIndex.AggregateService/. ./OSItemIndex.AggregateService/
18+
COPY OSItemIndex.API/. ./OSItemIndex.API/
19+
20+
WORKDIR "/src/OSItemIndex.Aggregator.OSRSBox"
21+
RUN dotnet build "OSItemIndex.Aggregator.OSRSBox.csproj" -c Release -o /app/build
1422

1523
FROM build AS publish
16-
RUN dotnet publish "OSItemIndex.Observer.csproj" -c Release -o /app/publish
24+
RUN dotnet publish "OSItemIndex.Aggregator.OSRSBox.csproj" -c Release -o /app/publish
1725

1826
FROM base AS final
1927
WORKDIR /app
2028
COPY --from=publish /app/publish .
21-
ENTRYPOINT ["dotnet", "OSItemIndex.Observer.dll"]
29+
ENTRYPOINT ["dotnet", "OSItemIndex.Aggregator.OSRSBox.dll"]
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace OSItemIndex.AggregateService
2+
{
3+
public class Constants
4+
{
5+
// Our user-agent all requests use so we can easily be identified and contacted
6+
public const string ObserverUserAgent = "OSItemIndex + OSItemIndex.Services/1.00 + github.com/OSItemIndex + Twinki#0001";
7+
}
8+
9+
public class Endpoints
10+
{
11+
public class OsrsBox
12+
{
13+
public const string Project = "https://release-monitoring.org/api/project/32210"; // pypi project id 32210
14+
public const string ItemsComplete = "https://www.osrsbox.com/osrsbox-db/items-complete.json"; // static json-api
15+
}
16+
17+
public class Realtime
18+
{
19+
public const string PriceLatest = "https://prices.runescape.wiki/api/v1/osrs/latest";
20+
public const string PriceFiveMin = "https://prices.runescape.wiki/api/v1/osrs/5m";
21+
public const string PriceOneHour = "https://prices.runescape.wiki/api/v1/osrs/1h";
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Microsoft.AspNetCore.Hosting;
2+
using Microsoft.Extensions.Hosting;
3+
using Microsoft.Extensions.Logging;
4+
using Serilog;
5+
using Serilog.Events;
6+
using Serilog.Exceptions;
7+
8+
namespace OSItemIndex.AggregateService
9+
{
10+
public static class HostBuilderExtensions
11+
{
12+
public static IHost BuildBasicServiceHost<TStartup>(string[] args) where TStartup : class
13+
{
14+
return Host.CreateDefaultBuilder(args)
15+
.ConfigureForSerilog()
16+
.ConfigureWebHostDefaults(webBuilder =>
17+
{
18+
webBuilder.UseStartup<TStartup>();
19+
})
20+
.Build();
21+
}
22+
23+
public static IHostBuilder ConfigureForSerilog(this IHostBuilder builder)
24+
{
25+
builder.ConfigureLogging(logging => { logging.ClearProviders(); }); // remove default providers
26+
builder.UseSerilog((hostingContext, services, loggerConfiguration) => loggerConfiguration
27+
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
28+
.Enrich.FromLogContext()
29+
.Enrich.WithThreadId()
30+
.Enrich.WithExceptionDetails()
31+
.WriteTo.Console(outputTemplate:
32+
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")); // {Properties:j}
33+
return builder;
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)