Skip to content

mobile: fix setRuntimeGuard Swift API#26013

Merged
jpsim merged 2 commits intoenvoyproxy:mainfrom
jpsim:jp-fix-swift-set-runtime-guard
Mar 9, 2023
Merged

mobile: fix setRuntimeGuard Swift API#26013
jpsim merged 2 commits intoenvoyproxy:mainfrom
jpsim:jp-fix-swift-set-runtime-guard

Conversation

@jpsim
Copy link
Copy Markdown
Contributor

@jpsim jpsim commented Mar 9, 2023

This was never fully hooked up to the C++ builder in -[EnvoyConfiguration applyToCXXBuilder].

Signed-off-by: JP Simard [email protected]

Commit Message:
Additional Description:
Risk Level: Low
Testing: Yes
Docs Changes: None
Release Notes: None
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

This was never fully hooked up to the C++ builder in
`-[EnvoyConfiguration applyToCXXBuilder]`.

Signed-off-by: JP Simard <[email protected]>
builder.enableBrotliDecompression(self.enableBrotliDecompression);

for (NSString *key in self.runtimeGuards) {
BOOL value = [[self.runtimeGuards objectForKey:key] isEqualToString:@"true"];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we apply false's too? For cases when default is equal to true and we want to override with false

Copy link
Copy Markdown
Contributor Author

@jpsim jpsim Mar 9, 2023

Choose a reason for hiding this comment

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

This applies true and false equally, as verified by the tests.

If you call .setRuntimeGuard("abc", false) from Swift then that gets mapped to an NSDictionary of @{@"abc", @"false"}, which means that [[self.runtimeGuards objectForKey:@"abc"] isEqualToString:@"true"]; produces a result of NO, which passes to the C++ builder as builder.setRuntimeGuard("abc", false).

Co-authored-by: Rafał Augustyniak <[email protected]>
Signed-off-by: JP Simard <[email protected]>
@jpsim jpsim enabled auto-merge (squash) March 9, 2023 17:13
@jpsim jpsim merged commit 07f9e8f into envoyproxy:main Mar 9, 2023
@jpsim jpsim deleted the jp-fix-swift-set-runtime-guard branch March 9, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants