DS Store gitignore

This commit is contained in:
marko-kraemer 2025-04-13 13:59:33 +01:00 committed by Adam Cohen Hillel
parent c2ab65d0ed
commit db07dbdce8
7 changed files with 77 additions and 1 deletions

View File

@ -1 +1 @@
# AgentPress
# AgentPress

View File

@ -0,0 +1,10 @@
# If you're using stripe, replace this with your keys
STRIPE_API_KEY=sk_test_asdf
STRIPE_WEBHOOK_SIGNING_SECRET=whsec_asdf
STRIPE_DEFAULT_PLAN_ID=price_asdf
# this is the number of days that will be given to users for trialing
STRIPE_DEFAULT_TRIAL_DAYS=30
# The allowed host determines what hostnames are allowed to be used for return URLs back from the Stripe billing portal
# If you need to add multiple you can add them directly in the billing-functions function
ALLOWED_HOST=http://localhost:3000

View File

@ -305,3 +305,7 @@ s3_region = "env(S3_REGION)"
s3_access_key = "env(S3_ACCESS_KEY)"
# Configures AWS_SECRET_ACCESS_KEY for S3 bucket
s3_secret_key = "env(S3_SECRET_KEY)"
[functions.billing-webhooks]
verify_jwt = false

View File

@ -0,0 +1,5 @@
{
"imports": {
"@supabase/supabase-js": "https://esm.sh/@supabase/supabase-js"
}
}

View File

@ -0,0 +1,28 @@
import {serve} from "https://deno.land/std@0.168.0/http/server.ts";
import {billingFunctionsWrapper, stripeFunctionHandler} from "https://deno.land/x/basejump@v2.0.2/billing-functions/mod.ts";
import Stripe from "https://esm.sh/stripe@11.1.0?target=deno";
const defaultAllowedHost = Deno.env.get("ALLOWED_HOST") || "http://localhost:3000";
const stripeClient = new Stripe(Deno.env.get("STRIPE_API_KEY") as string, {
// This is needed to use the Fetch API rather than relying on the Node http
// package.
apiVersion: "2022-11-15",
httpClient: Stripe.createFetchHttpClient(),
});
const stripeHandler = stripeFunctionHandler({
stripeClient,
defaultPlanId: Deno.env.get("STRIPE_DEFAULT_PLAN_ID") as string,
defaultTrialDays: Deno.env.get("STRIPE_DEFAULT_TRIAL_DAYS") ? Number(Deno.env.get("STRIPE_DEFAULT_TRIAL_DAYS")) : undefined
});
const billingEndpoint = billingFunctionsWrapper(stripeHandler, {
allowedURLs: [defaultAllowedHost]
});
serve(async (req) => {
const response = await billingEndpoint(req);
return response;
});

View File

@ -0,0 +1,5 @@
{
"imports": {
"@supabase/supabase-js": "https://esm.sh/@supabase/supabase-js"
}
}

View File

@ -0,0 +1,24 @@
import {serve} from "https://deno.land/std@0.168.0/http/server.ts";
import {billingWebhooksWrapper, stripeWebhookHandler} from "https://deno.land/x/basejump@v2.0.2/billing-functions/mod.ts";
import Stripe from "https://esm.sh/stripe@11.1.0?target=deno";
const stripeClient = new Stripe(Deno.env.get("STRIPE_API_KEY") as string, {
// This is needed to use the Fetch API rather than relying on the Node http
// package.
apiVersion: "2022-11-15",
httpClient: Stripe.createFetchHttpClient(),
});
const stripeResponse = stripeWebhookHandler({
stripeClient,
stripeWebhookSigningSecret: Deno.env.get("STRIPE_WEBHOOK_SIGNING_SECRET") as string,
});
const webhookEndpoint = billingWebhooksWrapper(stripeResponse);
serve(async (req) => {
const response = await webhookEndpoint(req);
return response;
});