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

209
Views
Access Environment Variables in Assets Folder?

I have a script that I run post ng build that is located in my assets/js folder. In that script, I call an api and need to use an access token to do so. I tried to place this access token in the environments/environment.ts folder, but during execution of the script, the environment module cannot be found. How can I access environment.ts values in the assets folder?

const request = require('request');
const fs = require('fs');
const path = require('path');
const process = require('process');

fs.readdir('./dist/app', function(err,files) {
  if(err) {
    console.error( "Could not list the directory.", err );
    process.exit( 1 );
  }
});

const sendFile = function(file){
  request({
    url: 'https://api.rollbar.com/api/1/sourcemap',
    headers: {
      'content-type': 'multipart/form-data'
    },
    method: 'POST',
    multipart: [
      {
        'Content-Disposition': 'form-data; name="access_token"',
        body: environment.rollbar.accessToken //this is what I need
      }
    ]
  }, function(err, response, body) { if(err){ console.log('Could not send file', err) } else { console.log(body) } });
about 4 years ago · Juan Pablo Isaza
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!