numandev1 / react-native-keys

πŸ” Protected .ENVs variables in React Native πŸš€βœ¨
MIT License
314 stars 28 forks source link

Read env from Fastfile #76

Open detatsatrio opened 6 months ago

detatsatrio commented 6 months ago

Hi Guys, is possible to read env from keys to fastfile for fastlane feature?

I've try with ENV["APPCENTER_KEY"] is not working yet, same way with react-native-config.

Thanks in advance

github-actions[bot] commented 6 months ago

πŸ‘‹ @detatsatrio Thanks for opening your issue here! If you find this package useful hit the star🌟!

ngocle2497 commented 4 months ago

Hi Guys, is possible to read env from keys to fastfile for fastlane feature?

I've try with ENV["APPCENTER_KEY"] is not working yet, same way with react-native-config.

Thanks in advance

U can use this function to load env:

lane :load_env_from_json do |params|
  # Load environment variables from the JSON file
  json_data = JSON.parse(File.read(params[:file]))

  # Set the environment variables
  json_data.each do |key, value|
    json_data.each do |scope, values|
      values.each do |key, value|
        ENV["#{key}"] = value
      end
    end
  end
end