@depctdev/depct 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.cjs +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depctdev/depct",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "CLI for running Node apps with Depct instrumentation",
5
5
  "bin": {
6
6
  "depct": "src/index.cjs"
package/src/index.cjs CHANGED
@@ -174,6 +174,7 @@ function applyEnvOptions(baseEnv, options) {
174
174
 
175
175
  setIfProvided("DEPCT_PROJECT_ROOT", options.projectRoot && path.resolve(options.projectRoot));
176
176
  setIfProvided("DEPCT_PROJECT_ID", options.projectId);
177
+ setIfProvided("DEPCT_PROJECT_TOKEN", options.projectToken);
177
178
  setIfProvided("DEPCT_SERVER_URL", options.serverUrl);
178
179
  setIfProvided("DEPCT_EVENTS_PATH", options.eventsPath);
179
180
  setIfProvided("DEPCT_FLUSH_MAX_EVENTS", options.flushMaxEvents);
@@ -222,6 +223,7 @@ function readDepctrc() {
222
223
  const config = JSON.parse(raw);
223
224
  return {
224
225
  project_id: config.project_id,
226
+ project_token: config.project_token || "",
225
227
  project_name: config.project_name || "",
226
228
  server_url: config.server_url || process.env.DEPCT_SERVER_URL || "http://localhost:3100",
227
229
  include: config.include || DEFAULT_INCLUDE,
@@ -273,6 +275,7 @@ async function handleInit(argv) {
273
275
 
274
276
  const config = {
275
277
  project_id: result.project_id,
278
+ project_token: result.project_token,
276
279
  project_name: result.project_name,
277
280
  server_url: serverUrl,
278
281
  include: DEFAULT_INCLUDE,
@@ -379,6 +382,7 @@ async function handleGenerate(argv) {
379
382
  headers: {
380
383
  "content-type": "application/json",
381
384
  "content-encoding": "gzip",
385
+ "authorization": `Bearer ${config.project_token}`,
382
386
  },
383
387
  body: compressed,
384
388
  });
@@ -425,6 +429,9 @@ function handleRun(argv) {
425
429
  if (config.server_url && !options.serverUrl) {
426
430
  options.serverUrl = config.server_url;
427
431
  }
432
+ if (config.project_token) {
433
+ options.projectToken = config.project_token;
434
+ }
428
435
  } catch {
429
436
  // ignore parse errors
430
437
  }