Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5060

React application env config

$
0
0

I have a React application with the following contents in package.json:

"scripts": {"start": "react-scripts start","start:int": "env-cmd -f .env.int npm start","start:ua": "env-cmd -f .env.ua npm start","build": "react-scripts build","build:int": "env-cmd -f .env.int npm run-script build","build:ua": "env-cmd -f .env.ua npm run-script build","test": "react-scripts test","eject": "react-scripts eject"  }

I have a few files:

.env.int.env.ua

.env.int

REACT_APP_AAD_UI_APP_CLIENT_ID= xxxREACT_APP_AAD_API_APP_CLIENT_ID= yyyREACT_APP_AAD_APP_TENANT_ID= aaaREACT_APP_AAD_APP_SERVICE_BASE_URI= abc.com

.env.ua

REACT_APP_AAD_UI_APP_CLIENT_ID= mmmREACT_APP_AAD_API_APP_CLIENT_ID= nnnREACT_APP_AAD_APP_TENANT_ID= bbbREACT_APP_AAD_APP_SERVICE_BASE_URI= def.com

I have a YAML task to deploy a static web application:

- task: AzureStaticWebApp@0    name: DeployStaticWebApp    displayName: Deploy Static Web App    inputs:      app_location: 'web-app'      app_build_command: 'npm ci && npm run build:int'      cwd: '${{ parameters.root }}/webapp_package'      azure_static_web_apps_api_token: $(deployment_token) # captured from deploymentOutputs

Is it possible to avoid adding the values in .env files (to avoid exposing secrets publicly) and get the .env values from pipeline variables or some other place?

In the above example,

xxx, yyy, aaa, abc.com

mmm, nnn, bbb, def.com


Viewing all articles
Browse latest Browse all 5060


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>