Skip to content

Refactor mtaserver.conf.template #3857

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

Merged
merged 28 commits into from
Aug 17, 2025

Conversation

Fernando-A-Rocha
Copy link
Contributor

@Fernando-A-Rocha Fernando-A-Rocha commented Nov 14, 2024

Context

The mtaserver.conf.template file is a copy of mtaserver.conf without the <module> and <resource> nodes, that devs have been maintaining manually. Default config already comes in mtaserver.conf.

Without this PR, the script looks for mtaserver.conf.template, and if it finds it, it will scan for missing config nodes in the existing mtaserver.conf config, and then after it's done with the changes, it deletes the .template file. So it's only ever used once.

The problem is that real MTA servers never get their hands on the .template file, so it is never used.

  • mtaserver.conf.template file is not shipped with the server files via the installer or zip provided by mtasa.com.
  • This file is only present in the source code, which devs compiling mtasa manually will result in this file being moved to the build server
  • Devs compiling mtasa also don't need this template ever, because the default config is already in the mtaserver.conf file...
  • Also, the note in the beginning of the mtaserver.conf.template file is false <!-- This file is compiled into the server binary. This file is never compiled in the server binary, it even gets deleted after use by the script.

So, mtaserver.conf.template has had zero practical use over the last years.

What I changed

  • Deleted mtaserver.conf.template from files
  • Edited buildaction install_data.lua to automatically duplicate mtaserver.conf => mtaserver.conf.template
  • Also updated compose_files.lua to do this
  • Added mtaserver.conf.template to be included by the Installer (nightly.nsi)
  • Refactored AddMissingSettings():
    • Will not delete mtaserver.conf.template after running
    • Removed hungarian notation
    • Made the function not add missing resource/module nodes

Why?

  • We no longer need to duplicate every new/changed config setting to mtaserver.conf.template.
  • By shipping mtaserver.conf.template with the installer (overwrites existing mtaserver.conf.template of the server), servers owners will receive updates to that file, so their server will receive new settings added by newer server builds, which will then be automatically inserted in the server's mtaserver.conf

@Nico8340

This comment was marked as outdated.

@Fernando-A-Rocha

This comment was marked as outdated.

@Fernando-A-Rocha

This comment was marked as outdated.

@Nico8340

This comment was marked as outdated.

@Fernando-A-Rocha Fernando-A-Rocha changed the title Remove mtaserver.conf.template Refactor mtaserver.conf.template Nov 15, 2024
@Fernando-A-Rocha
Copy link
Contributor Author

Fernando-A-Rocha commented Nov 15, 2024

Why not use the template file if you already have existing logic for it? I think it's unnecessary to embed the entire config in the code and use it for every reinstallation, instead this should be done from one file, which is this template file

Hmm, check out what I did.

@TheNormalnij TheNormalnij added enhancement New feature or request refactor labels Nov 17, 2024
Copy link
Member

@Nico8340 Nico8340 left a comment

Choose a reason for hiding this comment

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

It looks good, although I recommend inserting a comment at the beginning of the template file to let the user know that they shouldn't change it

@Dutchman101
Copy link
Member

Dutchman101 commented Nov 21, 2024

Please resolve conflicts, @Fernando-A-Rocha

Didn't this appear for you?
Untitled

@Fernando-A-Rocha
Copy link
Contributor Author

Fernando-A-Rocha commented Nov 22, 2024

@Dutchman101 Merge conflict resolved. I will apply Nico's suggestion now.

@Fernando-A-Rocha
Copy link
Contributor Author

@Nico8340 All good now?

Copy link
Member

@Nico8340 Nico8340 left a comment

Choose a reason for hiding this comment

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

LGTM

@Fernando-A-Rocha
Copy link
Contributor Author

Ready

@Fernando-A-Rocha
Copy link
Contributor Author

@ project maintainers

merge conflict fixed again. this is ready. any opinions?

@Fernando-A-Rocha
Copy link
Contributor Author

Ready

@Fernando-A-Rocha
Copy link
Contributor Author

Feedback?

@Dutchman101
Copy link
Member

Thanks, you followed through with everything and were concise about what and why.

@Dutchman101 Dutchman101 merged commit bc431d8 into multitheftauto:master Aug 17, 2025
MTABot pushed a commit that referenced this pull request Aug 17, 2025
@botder botder added this to the 1.7.1 milestone Aug 17, 2025
@Dutchman101
Copy link
Member

Dutchman101 commented Aug 21, 2025

I'm sorry but this PR will have to be temporarily reverted.. it broke build because of a buildserver-local NSIS script issue that i tried to resolve there but was unable to. It will be re-introduced later by @botder if/when he gets to it, he knows his way around the buildscript better than me and i left him notes.

Reverted in 5c3b988

@Fernando-A-Rocha

Dutchman101 added a commit that referenced this pull request Aug 21, 2025
This reverts commit bc431d8.

Temporary, will be reintroduced later. Refer to new comment on PR  #3857 for details
MTABot pushed a commit that referenced this pull request Aug 21, 2025
5c3b988 Revert "Refactor mtaserver.conf.template (#3857)" This reverts commit bc431d8.
b4bfd3e Visual Studio Update
1307ddd Update client en_US pot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants