Skip to content

Commit

Permalink
clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro committed Sep 14, 2016
1 parent 7e35d2e commit 085704a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ios/ReactNativeConfig/BuildDotenvConfig.ruby
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

require "json"

# 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
else
custom_env = false
file = File.join(Dir.pwd, "../../../.env")
end

puts "Reading env from #{file}"

dotenv = begin
# find that above node_modules/react-native-config/ios/
raw = File.read(File.join(Dir.pwd, "../../../#{file}"))
raw = File.read(file)
raw.split("\n").inject({}) do |h, line|
key, val = line.split("=", 2)
if line.strip.empty? or line.start_with?('#')
Expand Down

0 comments on commit 085704a

Please sign in to comment.