Read port configuration from UserDefaults
Summary: This allows us to configure a simulator to use a non-default port pair by using the `defaults` mechanism. For instance, this can be done by running ``` xcrun simctl spawn booted defaults write "Apple Global Domain" "com.facebook.flipper.ports" -string "9088,9089" ``` Reviewed By: lblasa, timur-valiev Differential Revision: D30731874 fbshipit-source-id: 689d60b1c392f36dceef1b3c3cfa0c88f54a7a82
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a09d0d3834
commit
f87dfdfea0
@@ -35,7 +35,14 @@ static int const DEFAULT_SECURE_PORT = 8088;
|
|||||||
return envInt > 0 ? envInt : fallback;
|
return envInt > 0 ? envInt : fallback;
|
||||||
}
|
}
|
||||||
+ (NSString*)getFlipperPortsVariable {
|
+ (NSString*)getFlipperPortsVariable {
|
||||||
|
// Try to retrieve from environment first.
|
||||||
NSString* value = NSProcessInfo.processInfo.environment[@"FLIPPER_PORTS"];
|
NSString* value = NSProcessInfo.processInfo.environment[@"FLIPPER_PORTS"];
|
||||||
|
// If empty, check defaults instead.
|
||||||
|
if ([value length] == 0) {
|
||||||
|
value = [[NSUserDefaults standardUserDefaults]
|
||||||
|
stringForKey:@"com.facebook.flipper.ports"];
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user