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

Config simplification #84

Merged
merged 8 commits into from
Oct 26, 2024
Merged

Config simplification #84

merged 8 commits into from
Oct 26, 2024

Conversation

ReCore-sys
Copy link
Collaborator

@ReCore-sys ReCore-sys commented Oct 23, 2024

Simplifying the config system

Description

The config system was overly complicated and contained a lot of clutter that made it difficult to decipher. This PR changes the config init system from a complex OnceLock system to a much more streamlined lazy_static system. The change from runtime init to a "life before main" system is minor since the config would be one of the first things set up anyway. The only major issue would be not being able to use tracing since that won't have been initialized yet.
The other change implemented was changing how the favicon is fetched, switching it from a runtime loading to simply using lazy_static to bake the favicon directly into the binary.

Motivation and Context

This PR makes the config much easier to work with and debug. It was discussed with members in the discord server.

How has this been tested?

It has been tested manually since unit tests of this nature would be largely incompatible with CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (restructuring code, without changing its behavior)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Clippy passes with no warnings.

motd = ["Welcome to the server!", "Have a great time!", "Adventure awaits!"] # Message of the day
max_players = 100 # Maximum number of players
network_tick_rate = 20 # Network updates per second per user
world = "World" # The name of the world to load

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't the previous value for this world = "world"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but it doesn't really matter

Copy link

@GStudiosX2 GStudiosX2 Oct 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but it doesn't really matter

Yeah I guess it's not used yet still think it should be the same as it was before though

@Sweattypalms Sweattypalms merged commit 86f7c75 into rewrite/v3 Oct 26, 2024
3 checks passed
@ReCore-sys ReCore-sys deleted the rework/config branch December 1, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants