File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 738738 FYREPLACE_API_HOST_DEV = dev.api.fyreplace.app;
739739 FYREPLACE_API_HOST_LOCAL = localhost;
740740 FYREPLACE_API_HOST_MAIN = api.fyreplace.app;
741- FYREPLACE_API_PORT = 50051;
741+ FYREPLACE_API_PORT_DEFAULT_KEY = FPApiPortLocal;
742+ FYREPLACE_API_PORT_DEV = 443;
743+ FYREPLACE_API_PORT_LOCAL = 50051;
744+ FYREPLACE_API_PORT_MAIN = 443;
742745 FYREPLACE_LINK_HOSTS = "fyreplace.app;fyreplace.link";
743746 GENERATE_INFOPLIST_FILE = YES;
744747 INFOPLIST_FILE = FyreplaceLegacy/Config/Info.plist;
780783 FYREPLACE_API_HOST_DEV = dev.api.fyreplace.app;
781784 FYREPLACE_API_HOST_LOCAL = localhost;
782785 FYREPLACE_API_HOST_MAIN = api.fyreplace.app;
783- FYREPLACE_API_PORT = 50051;
786+ FYREPLACE_API_PORT_DEFAULT_KEY = FPApiPortMain;
787+ FYREPLACE_API_PORT_DEV = 443;
788+ FYREPLACE_API_PORT_LOCAL = 50051;
789+ FYREPLACE_API_PORT_MAIN = 443;
784790 FYREPLACE_LINK_HOSTS = "fyreplace.app;fyreplace.link";
785791 GENERATE_INFOPLIST_FILE = YES;
786792 INFOPLIST_FILE = FyreplaceLegacy/Config/Info.plist;
Original file line number Diff line number Diff line change @@ -6,14 +6,18 @@ extension Bundle {
66 static let apiHostLocalKey = " FPApiHostLocal "
77 static let apiHostDevKey = " FPApiHostDev "
88 static let apiHostMainKey = " FPApiHostMain "
9- static let apiPortKey = " FPApiPort "
9+ static let apiPortLocalKey = " FPApiPortLocal "
10+ static let apiPortDevKey = " FPApiPortDev "
11+ static let apiPortMainKey = " FPApiPortMain "
1012
1113 var bundleVersion : String { getString ( Self . bundleVersionKey) }
1214 var apiDefaultHostKey : String { getString ( Self . apiHostDefaultKeyKey) }
1315 var apiHostLocal : String { getString ( Self . apiHostLocalKey) }
1416 var apiHostDev : String { getString ( Self . apiHostDevKey) }
1517 var apiHostMain : String { getString ( Self . apiHostMainKey) }
16- var apiPort : Int { getInteger ( Self . apiPortKey) }
18+ var apiPortLocal : Int { getInteger ( Self . apiPortLocalKey) }
19+ var apiPortDev : Int { getInteger ( Self . apiPortDevKey) }
20+ var apiPortMain : Int { getInteger ( Self . apiPortMainKey) }
1721
1822 func getString( _ key: String ) -> String {
1923 return Bundle . main. infoDictionary![ key] as! String
Original file line number Diff line number Diff line change @@ -28,9 +28,15 @@ class Rpc: NSObject {
2828 private func makeChannel( ) -> ClientConnection {
2929 let hostKey = UserDefaults . standard. string ( forKey: " app:environment " ) ?? Bundle . main. apiDefaultHostKey
3030 let host = Bundle . main. getString ( hostKey)
31+ let port = switch host {
32+ case Bundle . main. apiHostLocal: Bundle . main. apiPortLocal
33+ case Bundle . main. apiHostDev: Bundle . main. apiPortDev
34+ case Bundle . main. apiHostMain: Bundle . main. apiPortMain
35+ default : 0
36+ }
3137 let builder = host == Bundle . main. apiHostLocal
3238 ? ClientConnection . insecure ( group: group)
3339 : ClientConnection . usingPlatformAppropriateTLS ( for: group)
34- return builder. connect ( host: host, port: Bundle . main . apiPort )
40+ return builder. connect ( host: host, port: port )
3541 }
3642}
You can’t perform that action at this time.
0 commit comments