Add documentation links to environment variable prompts

The environment variable prompts in the Turbo generator now include a link to the associated documentation. This addition helps guide end users in setting up their environment variables appropriately. The URL of the documentation page is declared as a constant, which is appended to each environment variable name to create the full documentation link.
This commit is contained in:
gbuomprisco
2024-06-13 11:22:18 +08:00
parent ca5e02f509
commit 9bf3f0ea4b

View File

@@ -3,6 +3,8 @@ import { writeFileSync } from 'node:fs';
import { generator } from '../../utils'; import { generator } from '../../utils';
const DOCS_URL = 'https://makerkit.dev/docs/next-supabase-turbo/environment-variables';
export function createEnvironmentVariablesGenerator( export function createEnvironmentVariablesGenerator(
plop: PlopTypes.NodePlopAPI, plop: PlopTypes.NodePlopAPI,
) { ) {
@@ -40,70 +42,70 @@ export function createEnvironmentVariablesGenerator(
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_SITE_URL', name: 'values.NEXT_PUBLIC_SITE_URL',
message: message:
'What is the site URL of you website? (Ex. https://makerkit.dev)', `What is the site URL of you website? (Ex. https://makerkit.dev). \nFor more info: ${getUrlToDocs('NEXT_PUBLIC_SITE_URL')}\n`,
default: allVariables.NEXT_PUBLIC_SITE_URL, default: allVariables.NEXT_PUBLIC_SITE_URL,
}, },
{ {
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_PRODUCT_NAME', name: 'values.NEXT_PUBLIC_PRODUCT_NAME',
message: 'What is the name of your product? (Ex. MakerKit)', message: `What is the name of your product? (Ex. MakerKit). \nFor more info: ${getUrlToDocs('NEXT_PUBLIC_PRODUCT_NAME')}\n`,
default: allVariables.NEXT_PUBLIC_PRODUCT_NAME, default: allVariables.NEXT_PUBLIC_PRODUCT_NAME,
}, },
{ {
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_SITE_TITLE', name: 'values.NEXT_PUBLIC_SITE_TITLE',
message: message:
'What is the title of your website? (Ex. MakerKit - The best way to make things)', `What is the title of your website? (Ex. MakerKit - The best way to make things). \nFor more info: ${getUrlToDocs('NEXT_PUBLIC_SITE_TITLE')}\n`,
default: allVariables.NEXT_PUBLIC_SITE_TITLE, default: allVariables.NEXT_PUBLIC_SITE_TITLE,
}, },
{ {
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_SITE_DESCRIPTION', name: 'values.NEXT_PUBLIC_SITE_DESCRIPTION',
message: message:
'What is the description of your website? (Ex. MakerKit is the best way to make things and stuff)', `What is the description of your website? (Ex. MakerKit is the best way to make things and stuff). \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_SITE_DESCRIPTION")}\n`,
default: allVariables.NEXT_PUBLIC_SITE_DESCRIPTION, default: allVariables.NEXT_PUBLIC_SITE_DESCRIPTION,
}, },
{ {
type: 'list', type: 'list',
name: 'values.NEXT_PUBLIC_DEFAULT_THEME_MODE', name: 'values.NEXT_PUBLIC_DEFAULT_THEME_MODE',
message: 'What is the default theme mode of your website?', message: `What is the default theme mode of your website? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_DEFAULT_THEME_MODE")}\n`,
choices: ['light', 'dark', 'system'], choices: ['light', 'dark', 'system'],
default: allVariables.NEXT_PUBLIC_DEFAULT_THEME_MODE ?? 'light', default: allVariables.NEXT_PUBLIC_DEFAULT_THEME_MODE ?? 'light',
}, },
{ {
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_DEFAULT_LOCALE', name: 'values.NEXT_PUBLIC_DEFAULT_LOCALE',
message: 'What is the default locale of your website?', message: `What is the default locale of your website? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_DEFAULT_LOCALE")}\n`,
default: allVariables.NEXT_PUBLIC_DEFAULT_LOCALE ?? 'en', default: allVariables.NEXT_PUBLIC_DEFAULT_LOCALE ?? 'en',
}, },
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_AUTH_PASSWORD', name: 'values.NEXT_PUBLIC_AUTH_PASSWORD',
message: 'Do you want to use email/password authentication?', message: `Do you want to use email/password authentication? If not - we will hide the password login from the UI. \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_AUTH_PASSWORD")}\n`,
default: getBoolean(allVariables.NEXT_PUBLIC_AUTH_PASSWORD, true), default: getBoolean(allVariables.NEXT_PUBLIC_AUTH_PASSWORD, true),
}, },
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_AUTH_MAGIC_LINK', name: 'values.NEXT_PUBLIC_AUTH_MAGIC_LINK',
message: 'Do you want to use magic link authentication?', message: `Do you want to use magic link authentication? If not - we will hide the magic link login from the UI. \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_AUTH_MAGIC_LINK")}\n`,
default: getBoolean(allVariables.NEXT_PUBLIC_AUTH_MAGIC_LINK, false), default: getBoolean(allVariables.NEXT_PUBLIC_AUTH_MAGIC_LINK, false),
}, },
{ {
type: 'input', type: 'input',
name: 'values.CONTACT_EMAIL', name: 'values.CONTACT_EMAIL',
message: 'What is the contact email you want to receive emails to?', message: `What is the contact email you want to receive emails to? \nFor more info: ${getUrlToDocs("CONTACT_EMAIL")}\n`,
default: allVariables.CONTACT_EMAIL, default: allVariables.CONTACT_EMAIL,
}, },
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_THEME_TOGGLE', name: 'values.NEXT_PUBLIC_ENABLE_THEME_TOGGLE',
message: 'Do you want to enable the theme toggle?', message: `Do you want to enable the theme toggle? If not - we will hide the theme toggle from the UI. \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_THEME_TOGGLE")}\n`,
default: getBoolean(allVariables.NEXT_PUBLIC_ENABLE_THEME_TOGGLE, true), default: getBoolean(allVariables.NEXT_PUBLIC_ENABLE_THEME_TOGGLE, true),
}, },
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION', name: 'values.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION',
message: 'Do you want to enable personal account deletion?', message: `Do you want to enable personal account deletion? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION, allVariables.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION,
true, true,
@@ -112,7 +114,7 @@ export function createEnvironmentVariablesGenerator(
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING', name: 'values.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING',
message: 'Do you want to enable personal account billing?', message: `Do you want to enable personal account billing? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING, allVariables.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING,
true, true,
@@ -121,7 +123,7 @@ export function createEnvironmentVariablesGenerator(
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS', name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS',
message: 'Do you want to enable team accounts?', message: `Do you want to enable team accounts? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS, allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS,
true, true,
@@ -130,7 +132,7 @@ export function createEnvironmentVariablesGenerator(
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNT_DELETION', name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNT_DELETION',
message: 'Do you want to enable team account deletion?', message: `Do you want to enable team account deletion? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_TEAM_ACCOUNT_DELETION")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNT_DELETION, allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNT_DELETION,
true, true,
@@ -139,8 +141,9 @@ export function createEnvironmentVariablesGenerator(
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING', name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING',
message: 'Do you want to enable team account billing?', message: `Do you want to enable team account billing? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING, allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING,
true, true,
), ),
@@ -148,7 +151,7 @@ export function createEnvironmentVariablesGenerator(
{ {
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION', name: 'values.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION',
message: 'Do you want to enable team account creation?', message: `Do you want to enable team account creation? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION, allVariables.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION,
true, true,
@@ -158,7 +161,7 @@ export function createEnvironmentVariablesGenerator(
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_ENABLE_NOTIFICATIONS', name: 'values.NEXT_PUBLIC_ENABLE_NOTIFICATIONS',
message: message:
'Do you want to enable notifications? If not - we will hide the notifications bell from the UI.', `Do you want to enable notifications? If not - we will hide the notifications bell from the UI. \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_ENABLE_NOTIFICATIONS")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_ENABLE_NOTIFICATIONS, allVariables.NEXT_PUBLIC_ENABLE_NOTIFICATIONS,
true, true,
@@ -169,7 +172,7 @@ export function createEnvironmentVariablesGenerator(
type: 'confirm', type: 'confirm',
name: 'values.NEXT_PUBLIC_REALTIME_NOTIFICATIONS', name: 'values.NEXT_PUBLIC_REALTIME_NOTIFICATIONS',
message: message:
'Do you want to enable realtime notifications? If yes, we will enable the realtime notifications from Supabase. If not - updated will be fetched lazily.', `Do you want to enable realtime notifications? If yes, we will enable the realtime notifications from Supabase. If not - updated will be fetched lazily.\nFor more info: ${getUrlToDocs("NEXT_PUBLIC_REALTIME_NOTIFICATIONS")}\n`,
default: getBoolean( default: getBoolean(
allVariables.NEXT_PUBLIC_REALTIME_NOTIFICATIONS, allVariables.NEXT_PUBLIC_REALTIME_NOTIFICATIONS,
false, false,
@@ -178,24 +181,23 @@ export function createEnvironmentVariablesGenerator(
{ {
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_SUPABASE_URL', name: 'values.NEXT_PUBLIC_SUPABASE_URL',
message: 'What is the Supabase URL? (Ex. https://yourapp.supabase.co)', message: `What is the Supabase URL? (Ex. https://yourapp.supabase.co).\nFor more info: ${getUrlToDocs("NEXT_PUBLIC_SUPABASE_URL")}\n`,
default: allVariables.NEXT_PUBLIC_SUPABASE_URL, default: allVariables.NEXT_PUBLIC_SUPABASE_URL,
}, },
{ {
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_SUPABASE_ANON_KEY', name: 'values.NEXT_PUBLIC_SUPABASE_ANON_KEY',
message: 'What is the Supabase anon key?', message: `What is the Supabase anon key?\nFor more info: ${getUrlToDocs("NEXT_PUBLIC_SUPABASE_ANON_KEY")}\n`,
default: allVariables.NEXT_PUBLIC_SUPABASE_ANON_KEY,
}, },
{ {
type: 'input', type: 'input',
name: 'values.SUPABASE_SERVICE_ROLE_KEY', name: 'values.SUPABASE_SERVICE_ROLE_KEY',
message: 'What is the Supabase Service Role Key?', message: `What is the Supabase Service Role Key?\nFor more info: ${getUrlToDocs("SUPABASE_SERVICE_ROLE_KEY")}\n`,
}, },
{ {
type: 'list', type: 'list',
name: 'values.NEXT_PUBLIC_BILLING_PROVIDER', name: 'values.NEXT_PUBLIC_BILLING_PROVIDER',
message: 'What is the billing provider you want to use?', message: `What is the billing provider you want to use?\nFor more info: ${getUrlToDocs("NEXT_PUBLIC_BILLING_PROVIDER")}\n`,
choices: ['stripe', 'lemon-squeezy'], choices: ['stripe', 'lemon-squeezy'],
default: allVariables.NEXT_PUBLIC_BILLING_PROVIDER ?? 'stripe', default: allVariables.NEXT_PUBLIC_BILLING_PROVIDER ?? 'stripe',
}, },
@@ -204,7 +206,7 @@ export function createEnvironmentVariablesGenerator(
answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'stripe', answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'stripe',
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY', name: 'values.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY',
message: 'What is the Stripe publishable key?', message: `What is the Stripe publishable key?\nFor more info: ${getUrlToDocs("NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY")}\n`,
default: allVariables.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, default: allVariables.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
}, },
{ {
@@ -212,28 +214,28 @@ export function createEnvironmentVariablesGenerator(
answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'stripe', answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'stripe',
type: 'input', type: 'input',
name: 'values.STRIPE_SECRET_KEY', name: 'values.STRIPE_SECRET_KEY',
message: 'What is the Stripe secret key?', message: `What is the Stripe secret key? \nFor more info: ${getUrlToDocs("NEXT_PUBLIC_BILLING_PROVIDER")}\n`,
}, },
{ {
when: (answers) => when: (answers) =>
answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'stripe', answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'stripe',
type: 'input', type: 'input',
name: 'values.STRIPE_WEBHOOK_SECRET', name: 'values.STRIPE_WEBHOOK_SECRET',
message: 'What is the Stripe webhook secret?', message: `What is the Stripe webhook secret? \nFor more info: ${getUrlToDocs("STRIPE_WEBHOOK_SECRET")}\n`,
}, },
{ {
when: (answers) => when: (answers) =>
answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'lemon-squeezy', answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'lemon-squeezy',
type: 'input', type: 'input',
name: 'values.LEMON_SQUEEZY_SECRET_KEY', name: 'values.LEMON_SQUEEZY_SECRET_KEY',
message: 'What is the Lemon Squeezy secret key?', message: `What is the Lemon Squeezy secret key? \nFor more info: ${getUrlToDocs("LEMON_SQUEEZY_SECRET_KEY")}\n`,
}, },
{ {
when: (answers) => when: (answers) =>
answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'lemon-squeezy', answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'lemon-squeezy',
type: 'input', type: 'input',
name: 'values.LEMON_SQUEEZY_STORE_ID', name: 'values.LEMON_SQUEEZY_STORE_ID',
message: 'What is the Lemon Squeezy store ID?', message: `What is the Lemon Squeezy store ID? \nFor more info: ${getUrlToDocs("LEMON_SQUEEZY_STORE_ID")}\n`,
default: allVariables.LEMON_SQUEEZY_STORE_ID, default: allVariables.LEMON_SQUEEZY_STORE_ID,
}, },
{ {
@@ -241,24 +243,24 @@ export function createEnvironmentVariablesGenerator(
answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'lemon-squeezy', answers.values.NEXT_PUBLIC_BILLING_PROVIDER === 'lemon-squeezy',
type: 'input', type: 'input',
name: 'values.LEMON_SQUEEZY_SIGNING_SECRET', name: 'values.LEMON_SQUEEZY_SIGNING_SECRET',
message: 'What is the Lemon Squeezy signing secret?', message: `What is the Lemon Squeezy signing secret?\nFor more info: ${getUrlToDocs("LEMON_SQUEEZY_SIGNING_SECRET")}\n`,
}, },
{ {
type: 'input', type: 'input',
name: 'values.SUPABASE_DB_WEBHOOK_SECRET', name: 'values.SUPABASE_DB_WEBHOOK_SECRET',
message: 'What is the Supabase DB webhook secret?', message: `What is the DB webhook secret?\nFor more info: ${getUrlToDocs("SUPABASE_DB_WEBHOOK_SECRET")}\n`,
}, },
{ {
type: 'list', type: 'list',
name: 'values.CMS_CLIENT', name: 'values.CMS_CLIENT',
message: 'What is the CMS client you want to use?', message: `What is the CMS client you want to use?\nFor more info: ${getUrlToDocs("CMS_CLIENT")}\n`,
choices: ['keystatic', 'wordpress'], choices: ['keystatic', 'wordpress'],
default: allVariables.CMS_CLIENT ?? 'keystatic', default: allVariables.CMS_CLIENT ?? 'keystatic',
}, },
{ {
type: 'list', type: 'list',
name: 'values.MAILER_PROVIDER', name: 'values.MAILER_PROVIDER',
message: 'What is the mailer provider you want to use?', message: `What is the mailer provider you want to use?\nFor more info: ${getUrlToDocs("MAILER_PROVIDER")}\n`,
choices: ['nodemailer', 'resend'], choices: ['nodemailer', 'resend'],
default: allVariables.MAILER_PROVIDER ?? 'nodemailer', default: allVariables.MAILER_PROVIDER ?? 'nodemailer',
}, },
@@ -266,64 +268,64 @@ export function createEnvironmentVariablesGenerator(
when: (answers) => answers.values.MAILER_PROVIDER === 'resend', when: (answers) => answers.values.MAILER_PROVIDER === 'resend',
type: 'input', type: 'input',
name: 'values.RESEND_API_KEY', name: 'values.RESEND_API_KEY',
message: 'What is the Resend API key?', message: `What is the Resend API key?\nFor more info: ${getUrlToDocs("RESEND_API_KEY")}\n`,
}, },
{ {
when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer', when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer',
type: 'input', type: 'input',
name: 'values.EMAIL_SENDER', name: 'values.EMAIL_SENDER',
message: 'What is the email sender? (ex. info@makerkit.dev)', message: `What is the email sender? (ex. info@makerkit.dev).\nFor more info: ${getUrlToDocs("EMAIL_SENDER")}\n`,
}, },
{ {
when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer', when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer',
type: 'input', type: 'input',
name: 'values.EMAIL_HOST', name: 'values.EMAIL_HOST',
message: 'What is the email host?', message: `What is the email host?\nFor more info: ${getUrlToDocs("EMAIL_HOST")}\n`,
}, },
{ {
when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer', when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer',
type: 'input', type: 'input',
name: 'values.EMAIL_PORT', name: 'values.EMAIL_PORT',
message: 'What is the email port?', message: `What is the email port?\nFor more info: ${getUrlToDocs("EMAIL_PORT")}\n`,
}, },
{ {
when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer', when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer',
type: 'input', type: 'input',
name: 'values.EMAIL_USER', name: 'values.EMAIL_USER',
message: 'What is the email username? (check your email provider)', message: `What is the email username? (check your email provider).\nFor more info: ${getUrlToDocs("EMAIL_USER")}\n`,
}, },
{ {
when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer', when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer',
type: 'input', type: 'input',
name: 'values.EMAIL_PASSWORD', name: 'values.EMAIL_PASSWORD',
message: 'What is the email password? (check your email provider)', message: `What is the email password? (check your email provider).\nFor more info: ${getUrlToDocs("EMAIL_PASSWORD")}\n`,
}, },
{ {
when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer', when: (answers) => answers.values.MAILER_PROVIDER === 'nodemailer',
type: 'confirm', type: 'confirm',
name: 'values.EMAIL_TLS', name: 'values.EMAIL_TLS',
message: 'Do you want to enable TLS for your emails?', message: `Do you want to enable TLS for your emails?\nFor more info: ${getUrlToDocs("EMAIL_TLS")}\n`,
default: getBoolean(allVariables.EMAIL_TLS, true), default: getBoolean(allVariables.EMAIL_TLS, true),
}, },
{ {
type: 'confirm', type: 'confirm',
name: 'captcha', name: 'captcha',
message: message:
'Do you want to enable Cloudflare Captcha protection for the Auth endpoints?', `Do you want to enable Cloudflare Captcha protection for the Auth endpoints?`,
}, },
{ {
when: (answers) => answers.captcha, when: (answers) => answers.captcha,
type: 'input', type: 'input',
name: 'values.NEXT_PUBLIC_CAPTCHA_SITE_KEY', name: 'values.NEXT_PUBLIC_CAPTCHA_SITE_KEY',
message: message:
'What is the Cloudflare Captcha site key? NB: this is the PUBLIC key!', `What is the Cloudflare Captcha site key? NB: this is the PUBLIC key!\nFor more info: ${getUrlToDocs("NEXT_PUBLIC_CAPTCHA_SITE_KEY")}\n`,
}, },
{ {
when: (answers) => answers.captcha, when: (answers) => answers.captcha,
type: 'input', type: 'input',
name: 'values.CAPTCHA_SECRET_TOKEN', name: 'values.CAPTCHA_SECRET_TOKEN',
message: message:
'What is the Cloudflare Captcha secret key? NB: this is the PRIVATE key!', `What is the Cloudflare Captcha secret key? NB: this is the PRIVATE key!\nFor more info: ${getUrlToDocs("CAPTCHA_SECRET_TOKEN")}\n`,
}, },
], ],
}); });
@@ -332,3 +334,7 @@ export function createEnvironmentVariablesGenerator(
function getBoolean(value: string | undefined, defaultValue: boolean) { function getBoolean(value: string | undefined, defaultValue: boolean) {
return value === 'true' ? true : defaultValue; return value === 'true' ? true : defaultValue;
} }
function getUrlToDocs(envVar: string) {
return `${DOCS_URL}#${envVar.toLowerCase()}`;
}