Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Load top players system settings from .env file #189

Merged
merged 1 commit into from
Oct 26, 2024
Merged
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
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ CommandCooldowns__Health=3
CommandCooldowns__Armour=3
CommandCooldowns__Coins=3

TopPlayers__RequiredTotalKills=150
TopPlayers__RequiredMaxKillingSpree=10

MariaDB__Server=mariadb
MariaDB__Port=3306
MariaDB__Database=gamemode
Expand Down
6 changes: 5 additions & 1 deletion src/Host/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ public void Configure(IServiceCollection services)
.GetRequiredSection("CommandCooldowns")
.Get<CommandCooldowns>();

var topPlayersSettings = configuration
.GetRequiredSection("TopPlayers")
.Get<TopPlayersSettings>();

services.ChooseDatabaseProvider(configuration);
services.AddApplicationServices();
services
.AddSingleton<IPasswordHasher, PasswordHasherBcrypt>()
.AddSingleton<IStreamerService, StreamerService>()
.AddSingleton(serverSettings)
.AddSingleton(commandCooldowns)
.AddSingleton(new TopPlayersSettings());
.AddSingleton(topPlayersSettings);

// Add systems to the services collection
services
Expand Down
Loading