Page MenuHomePhabricator

b[native] configure socket address on native with json file
AbandonedPublic

Authored by varun on Dec 5 2023, 8:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 8:27 AM
Unknown Object (File)
Mon, Oct 28, 10:09 AM
Unknown Object (File)
Sun, Oct 27, 8:20 AM
Unknown Object (File)
Oct 18 2024, 9:44 PM
Unknown Object (File)
Oct 18 2024, 9:38 PM
Unknown Object (File)
Sep 27 2024, 6:17 AM
Unknown Object (File)
Aug 29 2024, 4:08 AM
Unknown Object (File)
Aug 26 2024, 1:19 AM
Subscribers

Details

Reviewers
bartek
Summary

try to get identity service config from json file if it exists, otherwise just use default config

Depends on D10187

Test Plan

tbd

Diff Detail

Repository
rCOMM Comm
Branch
deleteuser (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

i meant to make this a draft diff.. i guess i can't undo that now. @bartek i'm having trouble reading from my native/facts/identity_service_config.json file because we build the native rust library and then Xcode links it in some sort of sandbox where the file isn't present. any thoughts on how to proceed here? i can just set the SOCKET_ADDR const in build.rs similar to how we set CODE_VERSION but wondering if there's a cleaner way...

varun published this revision for review.Dec 5 2023, 8:45 PM
varun planned changes to this revision.

i meant to make this a draft diff.. i guess i can't undo that now. @bartek i'm having trouble reading from my native/facts/identity_service_config.json file because we build the native rust library and then Xcode links it in some sort of sandbox where the file isn't present. any thoughts on how to proceed here? i can just set the SOCKET_ADDR const in build.rs similar to how we set CODE_VERSION but wondering if there's a cleaner way...

actually i think build.rs is the best solution

i meant to make this a draft diff.. i guess i can't undo that now. @bartek i'm having trouble reading from my native/facts/identity_service_config.json file because we build the native rust library and then Xcode links it in some sort of sandbox where the file isn't present. any thoughts on how to proceed here? i can just set the SOCKET_ADDR const in build.rs similar to how we set CODE_VERSION but wondering if there's a cleaner way...

actually i think build.rs is the best solution

I'm confused – what is actually being configured in build.rs here? Shouldn't this diff be using get_config introduced in D10148? Is there something "broken" with D10148?

i meant to make this a draft diff.. i guess i can't undo that now. @bartek i'm having trouble reading from my native/facts/identity_service_config.json file because we build the native rust library and then Xcode links it in some sort of sandbox where the file isn't present. any thoughts on how to proceed here? i can just set the SOCKET_ADDR const in build.rs similar to how we set CODE_VERSION but wondering if there's a cleaner way...

actually i think build.rs is the best solution

I'm confused – what is actually being configured in build.rs here? Shouldn't this diff be using get_config introduced in D10148? Is there something "broken" with D10148?

That diff is for keyserver only. Native apps don't support reading env vars in runtime - their runtime is smartphone or simulator, they should be separated from host machine. Also reading file at runtime on mobile app means searching for it on the device's disk (or emulator-specific directories).
React-Native/Expo provide hacks to expose env vars to JS via Metro bundler (I used this in natDevHostname) but for Rust the values need to be accessible in native code.

build.rs will work but it's cumbersome to rebuild native app just to change identity endpoint. On the other hand, passing values JS -> Rust sounds like lots of additional work (or am I wrong?). Wondering if there's a better solution.

Thanks for clarifying, @bartek! I definitely got myself confused there. We don't use getCommConfig in JS on native currently either, so I don't think there's any expectation to use get_config in Rust on native.

I share your concerns that build.rs is an unideal place to put this config, but I'm not sure of any alternatives. Don't want to block this diff if there are no obvious alternatives.

thanks for explaining, @bartek :)

passing values JS -> Rust sounds like lots of additional work (or am I wrong?)

yeah it feels like a lot of unnecessary work... i'm think this task would make it easier though: https://linear.app/comm/issue/ENG-6026/avoid-creating-new-clients-each-time-we-call-grpc-client-methods

I'm going to abandon this diff and just update the previous one because i had to completely change my approach