diff --git a/android/dotenv.gradle b/android/dotenv.gradle index dcef1cc4..a3c1b984 100644 --- a/android/dotenv.gradle +++ b/android/dotenv.gradle @@ -50,7 +50,7 @@ def loadDotEnv(flavor = getCurrentFlavor()) { f.eachLine { line -> def matcher = (line =~ /^\s*(?:export\s+|)([\w\d\.\-_]+)\s*=\s*['"]?(.*?)?['"]?\s*$/) if (matcher.getCount() == 1 && matcher[0].size() == 3) { - env.put(matcher[0][1], matcher[0][2].replace('"', '\\"')) + env.put(matcher[0][1], System.env[matcher[0][1]] || matcher[0][2].replace('"', '\\"')) } } } else { diff --git a/ios/ReactNativeConfig/ReactNativeConfig.m b/ios/ReactNativeConfig/ReactNativeConfig.m index d706432a..472d21f2 100644 --- a/ios/ReactNativeConfig/ReactNativeConfig.m +++ b/ios/ReactNativeConfig/ReactNativeConfig.m @@ -8,6 +8,8 @@ + (NSDictionary *)env { } + (NSString *)envFor: (NSString *)key { + NSString *envValue = (NSString *)[[[NSProcessInfo processInfo]environment]objectForKey:key]; + if (envValue) return envValue; NSString *value = (NSString *)[self.env objectForKey:key]; return value; }