Skip to content

Add support for configuration file #62

Closed

Description

@michalchudziak

Description

We need to add support for configuration file instead of adding various CLI options.

A react-native-brownfield config can be created in these three ways (ordered by priority):

react-native-brownfield.config.js
react-native-brownfield.config.json
The react-native-brownfield field in package.json

Acceptance criteria

  • a readConfiguration function available in cli/helpers directory
  • the function in question accepts path to config file as the only argument
  • the function returns correctly parsed configuration object

Activity

  1. FabianUntermoser commented on Jan 28, 2026

    @FabianUntermoser

    Any update on this? Id like for my native host app to be able to configure parts of the SDK I build with rock.

  2. thymikee commented on Jan 28, 2026

    @thymikee
    Member

    This issue is very much outdated. What is the use case that you’re chasing after?

  3. FabianUntermoser commented on Jan 28, 2026

    @FabianUntermoser

    Thanks for responding so quicky. I'd like my native host app (android/ios) to be able to provide runtime configuration for my react native SDK. It should be possible to read environment variables, however file based configuration would be more practical. It would be ideal, if I could stay mostly in the react native word, without having to create native classes. Can you point me to the right direction?

  4. thymikee commented on Jan 28, 2026

    @thymikee
    Member

    Yeah, "runtime" and "env variables" are on quite opposite ends. We recently created Brownie, which as two-way data storage for brownfield, so you can exchange data between native and React Native. Maybe this is what you're looking for?

  5. FabianUntermoser commented on Jan 29, 2026

    @FabianUntermoser

    Sorry, Im new to brownfield development, and thanks for the pionter, but I'm not looking for a state management solution. Allow me to clarify.

    I have a native host app that consumes my SDK as an aar I built with rock. The native host app should be able to provide configuration values for this SDK, like APP_ENV. Configuration should be done at build time of the native host app, not at build time of the SDK. Does that make sense?

    From what I know my options are

    • Passing configuration as intial props for the RN root view
    • Write configuration to shared storage and read at SDK start

    The shared storage approach is not ideal when configuring secrets. So my current solution is to provide native code to pass values as initialprops, which i then store in memory for my RN views.

    Is it possible to provide configuration via native files (manifest, gradle.properties, ..) without having to write custom native code? I thought react-native-brownfield or rock already covers this, thats how I came to this issue.

  6. thymikee commented on Jan 29, 2026

    @thymikee
    Member

    Since the build steps are separate for React Native app (your SDK) and for your native app, I don't think there's a clear way of achieving that. But the initialProps mechanism is designed exactly for this use case – it's considered a best practice to pass data from native app (e.g. read through your .env or manifest) and pass that to React Native view as initial props. Anything that you can't achieve with that or you don't feel safe for any reason?

  7. FabianUntermoser commented on Jan 30, 2026

    @FabianUntermoser

    IF this is the intended way, then its ok. I didn't know if I should be doing something different. Thanks!

  8. thymikee commented on Jan 30, 2026

    @thymikee
    Member

    Yeah you're good to go @FabianUntermoser! Feel free to DM me if you need any help further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions