Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda