mirror of
https://github.com/status-im/react-native-config.git
synced 2025-02-24 04:48:16 +00:00
take custom env for ios in a file :{ /tmp/envfile
not great but dunno how to do it otherwise yet
This commit is contained in:
parent
e430e2acbf
commit
57ea6c3a03
Binary file not shown.
@ -2,8 +2,20 @@
|
||||
|
||||
require "json"
|
||||
|
||||
# find the project dotenv file above node_modules/react-native-config/ios/
|
||||
dotenv = File.read(File.join(Dir.pwd, "../../../.env")).split("\n").inject({}) do |h, line|
|
||||
# defaults
|
||||
file = ".env"
|
||||
custom_env = false
|
||||
|
||||
# pick a custom env file if set
|
||||
if File.exists?("/tmp/envfile")
|
||||
custom_env = true
|
||||
file = File.read("/tmp/envfile").strip
|
||||
end
|
||||
|
||||
puts "Reading env from #{file}"
|
||||
|
||||
# find that above node_modules/react-native-config/ios/
|
||||
dotenv = File.read(File.join(Dir.pwd, "../../../#{file}")).split("\n").inject({}) do |h, line|
|
||||
key, val = line.split("=", 2)
|
||||
h.merge!(key => val)
|
||||
end
|
||||
@ -18,4 +30,8 @@ EOF
|
||||
path = File.join(ENV["SYMROOT"], "GeneratedDotEnv.m")
|
||||
File.open(path, "w") { |f| f.puts template }
|
||||
|
||||
puts "Wrote to #{path}"
|
||||
if custom_env
|
||||
File.delete("/tmp/envfile")
|
||||
end
|
||||
|
||||
puts "Wrote to #{path}"
|
Loading…
x
Reference in New Issue
Block a user