forked from LBPUnion/ProjectLighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
148 additions
and
10 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
.idea/.idea.ProjectLighthouse/.idea/projectSettingsUpdater.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using LBPUnion.ProjectLighthouse; | ||
using LBPUnion.ProjectLighthouse.Configuration; | ||
using LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; | ||
using LBPUnion.ProjectLighthouse.Servers.Presence.Startup; | ||
using LBPUnion.ProjectLighthouse.Types.Misc; | ||
|
||
await StartupTasks.Run(ServerType.Presence); | ||
|
||
IHostBuilder builder = Host.CreateDefaultBuilder(); | ||
builder.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<PresenceStartup>(); | ||
webBuilder.UseUrls(ServerConfiguration.Instance.PresenceListenUrl); | ||
}); | ||
|
||
builder.ConfigureLogging(logging => | ||
{ | ||
logging.ClearProviders(); | ||
logging.AddProvider(new AspNetToLighthouseLoggerProvider()); | ||
}); | ||
|
||
await builder.Build().RunAsync(); |
26 changes: 26 additions & 0 deletions
26
ProjectLighthouse.Servers.Presence/ProjectLighthouse.Servers.Presence.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<AssemblyName>LBPUnion.ProjectLighthouse.Servers.Presence</AssemblyName> | ||
<RootNamespace>LBPUnion.ProjectLighthouse.Servers.Presence</RootNamespace> | ||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<NoWarn>$(NoWarn);1591</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ProjectLighthouse\ProjectLighthouse.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Controllers\" /> | ||
<Folder Include="Responses\" /> | ||
</ItemGroup> | ||
|
||
</Project> |
48 changes: 48 additions & 0 deletions
48
ProjectLighthouse.Servers.Presence/Startup/PresenceStartup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using LBPUnion.ProjectLighthouse.Configuration; | ||
using LBPUnion.ProjectLighthouse.Database; | ||
using LBPUnion.ProjectLighthouse.Middlewares; | ||
using LBPUnion.ProjectLighthouse.Serialization; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace LBPUnion.ProjectLighthouse.Servers.Presence.Startup; | ||
|
||
public class PresenceStartup | ||
{ | ||
public PresenceStartup(IConfiguration configuration) | ||
{ | ||
this.Configuration = configuration; | ||
} | ||
|
||
public IConfiguration Configuration { get; } | ||
|
||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddControllers(); | ||
|
||
services.AddMvc | ||
( | ||
options => | ||
{ | ||
options.OutputFormatters.Add(new JsonOutputFormatter()); | ||
} | ||
); | ||
|
||
services.AddDbContext<DatabaseContext>(builder => | ||
{ | ||
builder.UseMySql(ServerConfiguration.Instance.DbConnectionString, | ||
MySqlServerVersion.LatestSupportedServerVersion); | ||
}); | ||
} | ||
|
||
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env) | ||
{ | ||
#if DEBUG | ||
app.UseDeveloperExceptionPage(); | ||
#endif | ||
|
||
app.UseMiddleware<RequestLogMiddleware>(); | ||
|
||
app.UseRouting(); | ||
app.UseEndpoints(endpoints => endpoints.MapControllers()); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
ProjectLighthouse.Servers.Presence/Startup/PresenceTestStartup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using LBPUnion.ProjectLighthouse.Middlewares; | ||
|
||
namespace LBPUnion.ProjectLighthouse.Servers.Presence.Startup; | ||
|
||
public class PresenceTestStartup : PresenceStartup | ||
{ | ||
public PresenceTestStartup(IConfiguration configuration) : base(configuration) | ||
{} | ||
|
||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) | ||
{ | ||
app.UseMiddleware<FakeRemoteIPAddressMiddleware>(); | ||
base.Configure(app, env); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ProjectLighthouse.Servers.Presence/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ public enum ServerType | |
GameServer = 0, | ||
Website = 1, | ||
Api = 2, | ||
Presence = 3, | ||
} |