react-native-keys icon indicating copy to clipboard operation
react-native-keys copied to clipboard

[Proposal] JSON integrate

Open YangJonghun opened this issue 1 year ago • 2 comments

When we use react-native-keys, we need to add multiple JSON files for multiple build variants. and this approach is similar to using Dotenv. with JSON, however, we can handle multiple builds in a single file.

It also has the advantage of having a single set of common keys, which prevents the human error of managing multiple JSONs.

So I propose some schemas.

Sample1
  • react-native-keys.json
{
  "__common__": { // reserved key (optional)
    "secure": {
      "KEY1": "hi",
      "KEY2": "hi",
    },
    "public": {
      "KEY1": "hi",
      "KEY2": "hi",
    },
  },
  "development": {
    "secure": {
      "KEY1" : "bye" // overwrite
      "KEY3" : "new key"
    },
    "public": {
      ...
    },
  },
  "production": { // key could be customizable
    "secure": {
      ...
    },
    "public": {
      ...
    },
  },
}

or
Sample2
  • react-native-keys.json
{
  "secure": {
    "__common__": { // reserved key (optional)
      "KEY1": "hi",
      "KEY2": "hi",
    },
    "development": { // key could be customizable
      "KEY1": "bye", // overwrite
      "KEY3": "new key",
    },
    "production": { // key could be customizable
      "KEY3": "new key",
      "KEY4": "new key",
    }
  },
  "public": {
    "__common": {
      ...
    },
    "development": {
      ...
    },
    "production": {
      ...
    }
  }
}

I'd be grateful if you could consider it.

YangJonghun avatar Jul 27 '23 16:07 YangJonghun

@YangJonghun if some developer demand this then i will add this support, let see if demand increase or not, i added support for multiple JSON so developer can easily understand and migrate from react-native-config to react-native-keys easily

numandev1 avatar Jul 27 '23 22:07 numandev1

I think multiple JSON file will good to scale. with one json file and many member, conflict will happen easily

ngocle2497 avatar Jul 28 '23 10:07 ngocle2497

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 28 '24 02:07 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Aug 04 '24 02:08 github-actions[bot]