diff --git a/packages/config/src/Config.ts b/packages/config/src/Config.ts index 4df05c5c84..6e41538c57 100644 --- a/packages/config/src/Config.ts +++ b/packages/config/src/Config.ts @@ -7,6 +7,22 @@ import { AppJSONConfig, ExpRc, ExpoConfig, PackageJSONConfig, ProjectConfig } fr import { ConfigError } from './Errors'; import { getExpoSDKVersion } from './Project'; +let blacklistedEnvironmentVariables = new Set([ + 'EXPO_APPLE_PASSWORD', + 'EXPO_ANDROID_KEY_PASSWORD', + 'EXPO_ANDROID_KEYSTORE_PASSWORD', + 'EXPO_IOS_DIST_P12_PASSWORD', + 'EXPO_IOS_PUSH_P12_PASSWORD', + 'EXPO_CLI_PASSWORD', +]); + +function shouldExposeEnvironmentVariableInManifest(key) { + if (blacklistedEnvironmentVariables.has(key.toUpperCase())) { + return false; + } + return key.startsWith('REACT_NATIVE_') || key.startsWith('EXPO_'); +} + export function readConfigJson( projectRoot: string, skipValidation: boolean = false, @@ -161,6 +177,13 @@ function ensureConfigHasDefaultValues( exp.platforms = ['android', 'ios']; } + exp.env = {}; + for (let key of Object.keys(process.env)) { + if (shouldExposeEnvironmentVariableInManifest(key)) { + exp.env[key] = process.env[key]; + } + } + return { exp, pkg }; } diff --git a/packages/xdl/src/Project.ts b/packages/xdl/src/Project.ts index 34a8e6ae6d..bcf8248e2a 100644 --- a/packages/xdl/src/Project.ts +++ b/packages/xdl/src/Project.ts @@ -1943,22 +1943,6 @@ export async function stopReactNativeServerAsync(projectRoot: string): Promise { _assertValidProjectRoot(projectRoot); await stopExpoServerAsync(projectRoot); @@ -2002,14 +1986,9 @@ export async function startExpoServerAsync(projectRoot: string): Promise { projectRoot, }; manifest.packagerOpts = packagerOpts; - manifest.env = {}; - for (let key of Object.keys(process.env)) { - if (shouldExposeEnvironmentVariableInManifest(key)) { - manifest.env[key] = process.env[key]; - } - } - let platform = (req.headers['exponent-platform'] || 'ios').toString(); - let entryPoint = Exp.determineEntryPoint(projectRoot, platform); + let entryPoint = await Exp.determineEntryPointAsync(projectRoot); + let platform = req.headers['exponent-platform'] || 'ios'; + entryPoint = UrlUtils.getPlatformSpecificBundleUrl(entryPoint, platform); let mainModuleName = UrlUtils.guessMainModulePath(entryPoint); let queryParams = await UrlUtils.constructBundleQueryParamsAsync(projectRoot, packagerOpts); let path = `/${encodeURI(mainModuleName)}.bundle?platform=${encodeURIComponent(