config: preserve spacing when rewriting config

This commit is contained in:
Tulir Asokan
2024-08-27 17:16:54 +03:00
parent 1c2b902de4
commit 3378467378
2 changed files with 12 additions and 4 deletions
+11 -1
View File
@@ -98,7 +98,17 @@ func upgradeConfig(helper up.Helper) {
}
func (tg *TelegramConnector) GetConfig() (example string, data any, upgrader up.Upgrader) {
return ExampleConfig, tg.Config, up.SimpleUpgrader(upgradeConfig)
return ExampleConfig, tg.Config, &up.StructUpgrader{
SimpleUpgrader: up.SimpleUpgrader(upgradeConfig),
Blocks: [][]string{
{"device_info"},
{"animated_sticker"},
{"member_list"},
{"ping"},
{"sync"},
},
Base: ExampleConfig,
}
}
func (tg *TelegramConnector) ValidateConfig() error {
+1 -3
View File
@@ -2,6 +2,7 @@
api_id: 12345
api_hash: tjyd5yge35lbodk1xwzw2jstp90k55qz
# Device info shown in the Telegram device list.
device_info:
device_model: mautrix-telegram
system_version:
@@ -37,17 +38,14 @@ member_list:
#
# -1 means no limit (which means it's limited to 10000 by the server)
max_initial_sync: 100
# Whether or not to sync the member list in broadcast channels. If
# disabled, members will still be synced when they send messages.
#
# If no channel admins have logged into the bridge, the bridge won't be
# able to sync the member list regardless of this setting.
sync_broadcast_channels: false
# Whether or not to skip deleted members when syncing members.
skip_deleted: true
# Maximum number of participants in chats to bridge. Only applies when the
# portal is being created. If there are more members when trying to create a
# room, the room creation will be cancelled.