Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require test mode keys in setup script #5

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions scripts/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ function question(query: string): Promise<string> {

async function getStripeSecretKey(): Promise<string> {
console.log(`\n${chalk.bold('Getting Stripe Secret Key')}`);
console.log('You can find your Stripe Secret Key at: https://dashboard.stripe.com/test/apikeys');
return await question('Enter your Stripe Secret Key: ');
console.log('You can find your Stripe Test Secret Key at: https://dashboard.stripe.com/test/apikeys');
const key = await question('Enter your Stripe Secret Key: ');

if (key.includes('sk_test_')) {
return key;
}

console.log(chalk.red('Invalid Stripe Secret Key'));
console.log('Please use your test secret key and not your live secret key.');

return await getStripeSecretKey();
}

async function generateStripeProducts(stripeApiKey: string) {
Expand Down Expand Up @@ -109,9 +118,19 @@ async function connectStripeToWorkOS() {
async function getWorkOSSecretKey(): Promise<string> {
console.log(`\n${chalk.bold('Getting WorkOS API Keys')}`);
console.log(
'You can find your WorkOS API Key in the dashboard under the "Quick start" section: https://dashboard.workos.com/get-started',
'You can find your test WorkOS API Key in the dashboard under the "Quick start" section: https://dashboard.workos.com/get-started',
);
return await question('Enter your WorkOS API Key: ');

const key = await question('Enter your test WorkOS API Key: ');

if (key.includes('sk_test_')) {
return key;
}

console.log(chalk.red('Invalid WorkOS Secret Key'));
console.log('Please use your test secret key and not your live secret key.');

return await getWorkOSSecretKey();
}

async function getWorkOSClientId(): Promise<string> {
Expand Down