-
Notifications
You must be signed in to change notification settings - Fork 0
Edge Cases
This is a consolidation of weird edge cases and how to handle them with OmitFiles. If you find one that is not covered here create a GitHub issue and we can help you with it and add the solution to this page.
The key value is what you are trying to hide from the file before committing it. It may be the case that the value shows up elsewhere in your document. If you are trying to hide the value then it's probably a better idea to change it to something more unique, but if you are unable to or don't want to then there is a small workaround.
If the key is part of a file like YAML or JSON then the easiest way to hide just that value instead of others in the same document is to include the element in both filters. It sounds a bit awkward but can be done very easily.
If we look at the below YAML excerpt:
ForcedLanguage: none
Experiment_JdbcAccountLinkBackend: "jdbc:mysql://localhost:3306/ServerName?useSSL=false"
Experiment_JdbcTablePrefix: "discord"
Experiment_JdbcUsername: "ServerName"
Experiment_JdbcPassword: "oHrRpWTzSbVgMJvLDNGhoHrRpWTzSbVgMJvLDNGhoHrRpWTzSbVgMJvLDNGh"
...
DiscordGameStatus: "Play.ServerName.Net"
StatusUpdateRateInMinutes: 2
You can see that the term ServerName is in the file twice, but we only want to filter the occurrence under Experiment_JdbcUsername because it might be sensitive information. The easiest way to solve this without changing the value is to filter it with the element declaration like so:
[{
"file": "plugins/DiscordSRV/config.yml",
"filter": "Experiment_JdbcUsername: \"%Username%\"",
"key": "Experiment_JdbcUsername: \"ServerName\""
}]
Essentially for both the filter and the key you include the entire element declaration around it. This makes the filter and key unique with searching through the document. Since the filter is built in JSON you must escape any special characters such as " with the JSON escape character \.