Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Check Production and Staging environment inside HTML file in a React App

I am trying to integrate a 3rd party app inside my React App. I have to use different keys for production and staging but I am unable to figure out how to achieve that in React and Node applications I can do it by process.env but in index.html I am unable to figure out how can I achieve that.

Here is my pseudocode which I am trying to pull for my index.html file for my React project

<script>
if(env === production){
  some_app.init('TOKEN_FOR_PRODUCTION');
}
else{
  some_app.init('TOKEN_FOR_STAGING_OR_DEV');
}
</script>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

While I personally prefer to store all API keys on the server itself, this guide indicates that there are other ways to do it:

https://www.geeksforgeeks.org/how-to-hide-your-api-keys-from-public-in-reactjs/

Additionally, to define differences between prod and staging in the front end alone, I recommend defining plug in variables using webpack:

https://webpack.js.org/plugins/define-plugin/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!