-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pre-bake some vars and change telemetry handling
- Loading branch information
1 parent
142a38a
commit bb47f7a
Showing
12 changed files
with
130 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,24 @@ Configuring Infisical requires setting some environment variables. There is a fi | |
|
||
| Variable | Description | Default Value | | ||
| ---------------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------- | | ||
| `PRIVATE_KEY` | ❗️ NaCl-generated server secret key | `None` | | ||
| `PUBLIC_KEY` | ❗️ NaCl-generated server public key | `None` | | ||
| `ENCRYPTION_KEY` | ❗️ Strong hex encryption key | `None` | | ||
| `JWT_SIGNUP_SECRET` | ❗️JWT token secret | `None` | | ||
| `JWT_REFRESH_SECRET` | ❗️ JWT token secret | `None` | | ||
| `JWT_AUTH_SECRET` | ❗️ JWT token secret | `None` | | ||
| `PRIVATE_KEY` | ❗️ NaCl-generated server secret key | `None` | | ||
| `PUBLIC_KEY` | ❗️ NaCl-generated server public key | `None` | | ||
| `ENCRYPTION_KEY` | ❗️ Strong hex encryption key | `None` | | ||
| `JWT_SIGNUP_SECRET` | ❗️ JWT token secret | `None` | | ||
| `JWT_REFRESH_SECRET` | ❗️ JWT token secret | `None` | | ||
| `JWT_AUTH_SECRET` | ❗️ JWT token secret | `None` | | ||
| `JWT_SIGNUP_LIFETIME` | JWT token lifetime expressed in seconds or a string describing a time span (e.g. 60, "2 days", "10h", "7d") | `15m` | | ||
| `JWT_REFRESH_LIFETIME` | JWT token lifetime expressed in seconds or a string describing a time span (e.g. 60, "2 days", "10h", "7d") | `90d` | | ||
| `JWT_AUTH_LIFETIME` | JWT token lifetime expressed in seconds or a string describing a time span (e.g. 60, "2 days", "10h", "7d") | `10d` | | ||
| `EMAIL_TOKEN_LIFETIME` | Email OTP/magic-link lifetime expressed in seconds | `86400` | | ||
| `MONGO_URL` | ❗️ MongoDB instance connection string either to container instance or MongoDB Cloud | `None` | | ||
| `MONGO_URL` | ❗️ MongoDB instance connection string either to container instance or MongoDB Cloud | `None` | | ||
| `MONGO_USERNAME` | MongoDB username if using container | `None` | | ||
| `MONGO_PASSWORD` | MongoDB password if using container | `None` | | ||
| `SITE_URL` | ❗️ Site URL - should be an absolute URL including the protocol (e.g. `https://app.infisical.com`) | `None` | | ||
| `SMT_HOST` | Whether the user joined the community | `smtp.gmail.com` | | ||
| `SMTP_NAME` | Hostname to connect to for establishing SMTP connections (e.g. `Team`) | `None` | | ||
| `SMTP_USERNAME` | ❗️ Credential to connect to host (e.g. `[email protected]`) | `None` | | ||
| `SMTP_PASSWORD` | ❗️ Credential to connect to host | `None` | | ||
| `SITE_URL` | ❗️ Site URL - should be an absolute URL including the protocol (e.g. `https://app.infisical.com`) | `None` | | ||
| `SMTP_HOST` | Hostname to connect to for establishing SMTP connections | `smtp.gmail.com` | | ||
| `SMTP_NAME` | Name label to be used in From field (e.g. `Team`) | `None` | | ||
| `SMTP_USERNAME` | ❗️ Credential to connect to host (e.g. `[email protected]`) | `None` | | ||
| `SMTP_PASSWORD` | ❗️ Credential to connect to host | `None` | | ||
| `TELEMETRY_ENABLED` | `true` or `false`. [More](../overview). | `true` | | ||
| `OAUTH_CLIENT_SECRET_HEROKU` | OAuth client secret for Heroku integration | `None` | | ||
| `OAUTH_TOKEN_URL_HEROKU` | OAuth token URL for Heroku integration | `None` | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { initPostHog } from "~/components/analytics/posthog"; | ||
import { ENV } from "~/components/utilities/config"; | ||
|
||
class Capturer { | ||
constructor() { | ||
this.api = initPostHog(); | ||
} | ||
|
||
capture(item) { | ||
if (ENV == "production" && TELEMETRY_CAPTURING_ENABLED) { | ||
try { | ||
api.capture(item); | ||
} catch (error) { | ||
console.error("PostHog", error); | ||
} | ||
} | ||
} | ||
|
||
identify(id) { | ||
if (ENV == "production" && TELEMETRY_CAPTURING_ENABLED) { | ||
try { | ||
api.identify(id); | ||
} catch (error) { | ||
console.error("PostHog", error); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
class Telemetry { | ||
constructor() { | ||
if (!Telemetry.instance) { | ||
Telemetry.instance = new Capturer(); | ||
} | ||
} | ||
|
||
getInstance() { | ||
return Telemetry.instance; | ||
} | ||
} | ||
|
||
module.exports = Telemetry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
ORIGINAL=$1 | ||
REPLACEMENT=$2 | ||
|
||
if [ "${ORIGINAL}" = "${REPLACEMENT}" ]; then | ||
echo "Replacement is the same, skipping.." | ||
exit 0 | ||
fi | ||
|
||
echo "Replacing pre-baked value.." | ||
|
||
find /app/public /app/.next -type f ! -name "*.png" ! -name "*.svg" ! -name "*.gif" ! -name "*.jpg" ! -name "*.jpeg" ! -name "*.ico" | | ||
while read file; do | ||
sed -i "s|$ORIGINAL|$REPLACEMENT|g" "$file" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
VALUE=$1 | ||
|
||
find /app/public /app/.next -type f ! -name "*.png" ! -name "*.svg" ! -name "*.gif" ! -name "*.jpg" ! -name "*.jpeg" ! -name "*.ico" | | ||
while read file; do | ||
sed -i "s|TELEMETRY_CAPTURING_ENABLED|$VALUE|g" "$file" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
scripts/replace-variable.sh "$BAKED_NEXT_PUBLIC_POSTHOG_API_KEY" "$NEXT_PUBLIC_POSTHOG_API_KEY" | ||
|
||
if [ "$INFISICAL_TELEMETRY_ENABLED" != "false" ]; then | ||
echo "Telemetry is enabled" | ||
scripts/set-telemetry.sh true | ||
else | ||
echo "Client opted out of telemetry" | ||
scripts/set-telemetry.sh false | ||
fi | ||
|
||
|
||
node server.js |