Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Added instructions for configuring env vars

Steven Teyde2f2059bd90
diff --git a/.env.example b/.env.example
index afa326ecb0..77a053af75 100644
--- a/.env.example
+++ b/.env.example
@@ -1,22 +1,81 @@
-# Auto generated from Upstash integration (feel free to pull it from your Vercel project with `vc env pull`)
+###############################
+###### REQUIRED ENV VARS ######
+###############################
+
+# Tinybird – required for analytics
+# Get your Tinybird Auth Token here: https://www.tinybird.co/docs/concepts/auth-tokens.html
+TINYBIRD_API_KEY=
+
+# Vercel's Domains API – required for adding and removing domains
+# Learn how to set this up: https://vercel.com/templates/next.js/domains-api
+PROJECT_ID_VERCEL=
+TEAM_ID_VERCEL=
+AUTH_BEARER_TOKEN=
+
+# Upstash Redis – required for Redis caching
+# Get your Redis REST URL and Token here: https://upstash.com/docs/redis/overall/getstarted
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
-# Required for email auth – setup instructions here: https://next-auth.js.org/providers/email#configuration
-EMAIL_SERVER=
-EMAIL_FROM=
+# Upstash QStash – required for queues and background jobs
+# Get your QStash Token here: https://upstash.com/docs/qstash/overall/getstarted
+QSTASH_TOKEN=
+QSTASH_CURRENT_SIGNING_KEY=
+QSTASH_NEXT_SIGNING_KEY=
# Generate a random secret here: https://generate-secret.vercel.app/32
NEXTAUTH_SECRET=
+NEXTAUTH_URL=http://localhost:8888 # (only needed for localhost)
-###############################################################
-# Required for adding domains to Vercel using the Domains API
-###############################################################
-## Here's how you can get your Project & Team ID: https://vercel.com/guides/nextjs-multi-tenant-application#6.-add-custom-domains-with-the-vercel-api
-PROJECT_ID_VERCEL=
-TEAM_ID_VERCEL=
-## Here's how you can create an auth bearer token: https://vercel.com/guides/how-do-i-use-a-vercel-api-access-token#creating-an-access-token
-AUTH_BEARER_TOKEN=
+# MySQL Database via Planetscale
+# Get your MySQL Database URL here: https://planetscale.com/docs/tutorials/connect-nodejs-app
+DATABASE_URL=
+
+# Resend – required for emails
+# Get your Resend API Key here: https://resend.com/docs/send-with-nextjs
+RESEND_API_KEY=
+
+# Required for image uploads
+# Get your Cloudinary URL here: https://cloudinary.com/documentation/node_integration#configuration
+CLOUDINARY_URL=
+
+# Required for Google Auth
+# Learn how to set this up here: https://next-auth.js.org/providers/google
+GOOGLE_CLIENT_ID=
+GOOGLE_CLIENT_SECRET=
+
+# Required for Custom Social Media Cards feature
+# Apply for an API key here: https://unsplash.com/developers
+UNSPLASH_ACCESS_KEY=
+
+# Required for local testing
+# Get your ngrok URL here: https://ngrok.com/
+NGROK_URL=
+
+###############################
+###### OPTIONAL ENV VARS ######
+###############################
+
+# Stripe – used for subscriptions
+# If you don't need this, you can also remove the `lib/stripe` folder and all instances of `stripe` from the codebase
+NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
+STRIPE_SECRET_KEY=
+STRIPE_WEBHOOK_SECRET=
+
+# Edge Config – used for admin features like banning users, rate limiting etc.
+# Create one here: https://vercel.com/docs/storage/edge-config
+# Alternatively, if you don't need this, you can also remove `lib/edge-config.ts`
+# and all instances of `EDGE_CONFIG` and `EDGE_CONFIG_ID` from the codebase
+EDGE_CONFIG=
+EDGE_CONFIG_ID=
+
+# Bitly Importer: https://dub.co/blog/migration-assistants
+# Apply for an API key here: https://dev.bitly.com/
+NEXT_PUBLIC_BITLY_CLIENT_ID=
+BITLY_CLIENT_SECRET=
+NEXT_PUBLIC_BITLY_REDIRECT_URI=http://localhost:8888/api/callback/bitly
-# Required for SQL database: you can follow this guide to set this up: https://vercel.com/guides/nextjs-multi-tenant-application#2.-set-up-your-mysql-database
-DATABASE_URL=
\ No newline at end of file
+# Used for internal monitoring & paging
+# You can remove this by removing `DUB_SLACK_HOOK_CRON` and `DUB_SLACK_HOOK_LINKS` from the codebase
+DUB_SLACK_HOOK_CRON=
+DUB_SLACK_HOOK_LINKS=
diff --git a/.gitignore b/.gitignore
index 530473f69d..e1168450b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,10 +32,15 @@ yarn-error.log*
# vercel
.vercel
+# tinybird
+venv
+.tinyb
+
# typescript
*.tsbuildinfo
next-env.d.ts
+# miscellaneous
/pages/api/scripts*
.react-email
.contentlayer
diff --git a/lib/utils.ts b/lib/utils.ts
index 81534cb131..d663697aac 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -437,7 +437,12 @@ export const log = async ({
type: "cron" | "links";
mention?: boolean;
}) => {
- if (process.env.NODE_ENV === "development") console.log(message);
+ if (
+ process.env.NODE_ENV === "development" ||
+ !process.env.DUB_SLACK_HOOK_CRON ||
+ !process.env.DUB_SLACK_HOOK_LINKS
+ )
+ console.log(message);
/* Log a message to the console */
const HOOK = logTypeToEnv[type];
if (!HOOK) return;