Add way to exclude settings from backups (#1682)

* Add way to exclude settings from backups

* Exclude flaresolverrEnabled

* Exclude usernames/passwords

* Exclude writing deprecated settings to the backup

* Exclude AuthMode
This commit is contained in:
Mitchell Syer
2025-10-03 10:37:50 -04:00
committed by GitHub
parent 9a9c0532de
commit fb05371ac2
5 changed files with 57 additions and 5 deletions

View File

@@ -88,6 +88,12 @@ object SettingsBackupSettingsHandlerGenerator {
") as? ${getSettingType(setting, false)},",
)
}
val excludedSettings = settings.filter { it.excludeFromBackup == true }
excludedSettings.forEach { setting ->
appendLine(
"${setting.name} = null,".addIndentation(indentation * 4),
)
}
appendLine("),".addIndentation(indentation * 3))
appendLine(")".addIndentation(contentIndentation))
appendLine("}".addIndentation(indentation))
@@ -126,6 +132,9 @@ object SettingsBackupSettingsHandlerGenerator {
}
private fun getConfigAccess(setting: SettingsRegistry.SettingMetadata): String {
if (setting.excludeFromBackup == true || setting.deprecated != null) {
return "null"
}
if (setting.typeInfo.convertToBackupType != null) {
return "SettingsRegistry.get(\"${setting.name}\")!!.typeInfo.convertToBackupType!!(" +
"serverConfig.${setting.name}.value" +