Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
4ba2b787
Unverified
Commit
4ba2b787
authored
May 20, 2020
by
Tim Neutkens
Committed by
GitHub
May 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read process.env after loading .env files (#13087)
Fixes #13067
parent
49990f55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
storage.ts
packages/next/telemetry/storage.ts
+8
-4
No files found.
packages/next/telemetry/storage.ts
View file @
4ba2b787
...
@@ -26,8 +26,6 @@ const TELEMETRY_KEY_ID = `telemetry.anonymousId`
...
@@ -26,8 +26,6 @@ const TELEMETRY_KEY_ID = `telemetry.anonymousId`
// See the `oneWayHash` function.
// See the `oneWayHash` function.
const
TELEMETRY_KEY_SALT
=
`telemetry.salt`
const
TELEMETRY_KEY_SALT
=
`telemetry.salt`
const
{
NEXT_TELEMETRY_DISABLED
,
NEXT_TELEMETRY_DEBUG
}
=
process
.
env
type
TelemetryEvent
=
{
eventName
:
string
;
payload
:
object
}
type
TelemetryEvent
=
{
eventName
:
string
;
payload
:
object
}
type
EventContext
=
{
type
EventContext
=
{
anonymousId
:
string
anonymousId
:
string
...
@@ -51,10 +49,16 @@ export class Telemetry {
...
@@ -51,10 +49,16 @@ export class Telemetry {
private
conf
:
Conf
<
any
>
|
null
private
conf
:
Conf
<
any
>
|
null
private
sessionId
:
string
private
sessionId
:
string
private
rawProjectId
:
string
private
rawProjectId
:
string
private
NEXT_TELEMETRY_DISABLED
:
any
private
NEXT_TELEMETRY_DEBUG
:
any
private
queue
:
Set
<
Promise
<
RecordObject
>>
private
queue
:
Set
<
Promise
<
RecordObject
>>
constructor
({
distDir
}:
{
distDir
:
string
})
{
constructor
({
distDir
}:
{
distDir
:
string
})
{
// Read in the constructor so that .env can be loaded before reading
const
{
NEXT_TELEMETRY_DISABLED
,
NEXT_TELEMETRY_DEBUG
}
=
process
.
env
this
.
NEXT_TELEMETRY_DISABLED
=
NEXT_TELEMETRY_DISABLED
this
.
NEXT_TELEMETRY_DEBUG
=
NEXT_TELEMETRY_DEBUG
const
storageDirectory
=
getStorageDirectory
(
distDir
)
const
storageDirectory
=
getStorageDirectory
(
distDir
)
try
{
try
{
...
@@ -125,7 +129,7 @@ export class Telemetry {
...
@@ -125,7 +129,7 @@ export class Telemetry {
}
}
private
get
isDisabled
():
boolean
{
private
get
isDisabled
():
boolean
{
if
(
!!
NEXT_TELEMETRY_DISABLED
||
!
this
.
conf
)
{
if
(
!!
this
.
NEXT_TELEMETRY_DISABLED
||
!
this
.
conf
)
{
return
true
return
true
}
}
return
this
.
conf
.
get
(
TELEMETRY_KEY_ENABLED
,
true
)
===
false
return
this
.
conf
.
get
(
TELEMETRY_KEY_ENABLED
,
true
)
===
false
...
@@ -206,7 +210,7 @@ export class Telemetry {
...
@@ -206,7 +210,7 @@ export class Telemetry {
return
Promise
.
resolve
()
return
Promise
.
resolve
()
}
}
if
(
NEXT_TELEMETRY_DEBUG
)
{
if
(
this
.
NEXT_TELEMETRY_DEBUG
)
{
// Print to standard error to simplify selecting the output
// Print to standard error to simplify selecting the output
events
.
forEach
(({
eventName
,
payload
})
=>
events
.
forEach
(({
eventName
,
payload
})
=>
console
.
error
(
console
.
error
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment