Skip to content

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Sep 17, 2025

Split loading config vs homeserver setup

This allows us to get access to server_name so we can use it when creating the LoggingContext("main") in the future (pre-requisite for #18868).

This also allows us more flexibility to parse config however we want and setup a Synapse homeserver. Like what we do in Synapse Pro for Small Hosts.

Split out from #18868

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

This allows us to get access to `server_name` before
which we may want to use in the `with LoggingContext("main"):`
call early on.

This also allows us more flexibility to parse config however
we want and setup a Synapse homeserver. Like what we do
in Synapse Pro for Small Hosts.
Changes from 3a5bab7

```
git checkout 3a5bab7 -- synapse/app/admin_cmd.py synapse/app/appservice.py synapse/app/client_reader.py synapse/app/event_creator.py synapse/app/federation_reader.py synapse/app/federation_sender.py synapse/app/frontend_proxy.py synapse/app/generic_worker.py synapse/app/media_repository.py synapse/app/pusher.py synapse/app/synchrotron.py synapse/app/user_dir.py
```
Supports generation of config files, so is used for the main homeserver app.
Args:
description: TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prior art, something to do in the future

Comment on lines +428 to 430
homeserver_config = load_or_generate_config(sys.argv[1:])

with LoggingContext("main"):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To make things more clear, with #18868, this will look like the following in the future:

Suggested change
homeserver_config = load_or_generate_config(sys.argv[1:])
with LoggingContext("main"):
homeserver_config = load_or_generate_config(sys.argv[1:])
with LoggingContext(name="main", server_name=homeserver_config.server.server_name):

Args:
config_options_options: The options passed to Synapse. Usually `sys.argv[1:]`.
argv_options: The options passed to Synapse. Usually `sys.argv[1:]`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've renamed this to be argv_options given we expect to be passed everything after the executable name in the argv list.

@MadLittleMods MadLittleMods marked this pull request as ready for review September 17, 2025 20:09
@MadLittleMods MadLittleMods requested a review from a team as a code owner September 17, 2025 20:09
@MadLittleMods MadLittleMods merged commit 5be7679 into develop Sep 22, 2025
76 of 78 checks passed
@MadLittleMods MadLittleMods deleted the madlittlemods/split-loading-config-vs-setup branch September 22, 2025 19:53
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @reivilibre 🦫

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants