|
@@ -2,36 +2,9 @@ import { WebhookEndpoint } from "pulumi-stripe"
|
|
|
import { domain } from "./stage"
|
|
import { domain } from "./stage"
|
|
|
import { web } from "./app"
|
|
import { web } from "./app"
|
|
|
|
|
|
|
|
-export const stripeWebhook = new WebhookEndpoint("StripeWebhook", {
|
|
|
|
|
- url: $interpolate`https://api.gateway.${domain}/stripe/webhook`,
|
|
|
|
|
- enabledEvents: [
|
|
|
|
|
- "checkout.session.async_payment_failed",
|
|
|
|
|
- "checkout.session.async_payment_succeeded",
|
|
|
|
|
- "checkout.session.completed",
|
|
|
|
|
- "checkout.session.expired",
|
|
|
|
|
- "customer.created",
|
|
|
|
|
- "customer.deleted",
|
|
|
|
|
- "customer.updated",
|
|
|
|
|
- "customer.discount.created",
|
|
|
|
|
- "customer.discount.deleted",
|
|
|
|
|
- "customer.discount.updated",
|
|
|
|
|
- "customer.source.created",
|
|
|
|
|
- "customer.source.deleted",
|
|
|
|
|
- "customer.source.expiring",
|
|
|
|
|
- "customer.source.updated",
|
|
|
|
|
- "customer.subscription.created",
|
|
|
|
|
- "customer.subscription.deleted",
|
|
|
|
|
- "customer.subscription.paused",
|
|
|
|
|
- "customer.subscription.pending_update_applied",
|
|
|
|
|
- "customer.subscription.pending_update_expired",
|
|
|
|
|
- "customer.subscription.resumed",
|
|
|
|
|
- "customer.subscription.trial_will_end",
|
|
|
|
|
- "customer.subscription.updated",
|
|
|
|
|
- "customer.tax_id.created",
|
|
|
|
|
- "customer.tax_id.deleted",
|
|
|
|
|
- "customer.tax_id.updated",
|
|
|
|
|
- ],
|
|
|
|
|
-})
|
|
|
|
|
|
|
+////////////////
|
|
|
|
|
+// DATABASE
|
|
|
|
|
+////////////////
|
|
|
|
|
|
|
|
const DATABASE_USERNAME = new sst.Secret("DATABASE_USERNAME")
|
|
const DATABASE_USERNAME = new sst.Secret("DATABASE_USERNAME")
|
|
|
const DATABASE_PASSWORD = new sst.Secret("DATABASE_PASSWORD")
|
|
const DATABASE_PASSWORD = new sst.Secret("DATABASE_PASSWORD")
|
|
@@ -54,6 +27,10 @@ new sst.x.DevCommand("Studio", {
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+////////////////
|
|
|
|
|
+// AUTH
|
|
|
|
|
+////////////////
|
|
|
|
|
+
|
|
|
const GITHUB_CLIENT_ID_CONSOLE = new sst.Secret("GITHUB_CLIENT_ID_CONSOLE")
|
|
const GITHUB_CLIENT_ID_CONSOLE = new sst.Secret("GITHUB_CLIENT_ID_CONSOLE")
|
|
|
const GITHUB_CLIENT_SECRET_CONSOLE = new sst.Secret("GITHUB_CLIENT_SECRET_CONSOLE")
|
|
const GITHUB_CLIENT_SECRET_CONSOLE = new sst.Secret("GITHUB_CLIENT_SECRET_CONSOLE")
|
|
|
const GOOGLE_CLIENT_ID = new sst.Secret("GOOGLE_CLIENT_ID")
|
|
const GOOGLE_CLIENT_ID = new sst.Secret("GOOGLE_CLIENT_ID")
|
|
@@ -65,10 +42,44 @@ export const auth = new sst.cloudflare.Worker("AuthApi", {
|
|
|
link: [database, authStorage, GITHUB_CLIENT_ID_CONSOLE, GITHUB_CLIENT_SECRET_CONSOLE, GOOGLE_CLIENT_ID],
|
|
link: [database, authStorage, GITHUB_CLIENT_ID_CONSOLE, GITHUB_CLIENT_SECRET_CONSOLE, GOOGLE_CLIENT_ID],
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+////////////////
|
|
|
|
|
+// GATEWAY
|
|
|
|
|
+////////////////
|
|
|
|
|
+
|
|
|
|
|
+export const stripeWebhook = new WebhookEndpoint("StripeWebhook", {
|
|
|
|
|
+ url: $interpolate`https://api.gateway.${domain}/stripe/webhook`,
|
|
|
|
|
+ enabledEvents: [
|
|
|
|
|
+ "checkout.session.async_payment_failed",
|
|
|
|
|
+ "checkout.session.async_payment_succeeded",
|
|
|
|
|
+ "checkout.session.completed",
|
|
|
|
|
+ "checkout.session.expired",
|
|
|
|
|
+ "customer.created",
|
|
|
|
|
+ "customer.deleted",
|
|
|
|
|
+ "customer.updated",
|
|
|
|
|
+ "customer.discount.created",
|
|
|
|
|
+ "customer.discount.deleted",
|
|
|
|
|
+ "customer.discount.updated",
|
|
|
|
|
+ "customer.source.created",
|
|
|
|
|
+ "customer.source.deleted",
|
|
|
|
|
+ "customer.source.expiring",
|
|
|
|
|
+ "customer.source.updated",
|
|
|
|
|
+ "customer.subscription.created",
|
|
|
|
|
+ "customer.subscription.deleted",
|
|
|
|
|
+ "customer.subscription.paused",
|
|
|
|
|
+ "customer.subscription.pending_update_applied",
|
|
|
|
|
+ "customer.subscription.pending_update_expired",
|
|
|
|
|
+ "customer.subscription.resumed",
|
|
|
|
|
+ "customer.subscription.trial_will_end",
|
|
|
|
|
+ "customer.subscription.updated",
|
|
|
|
|
+ "customer.tax_id.created",
|
|
|
|
|
+ "customer.tax_id.deleted",
|
|
|
|
|
+ "customer.tax_id.updated",
|
|
|
|
|
+ ],
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const ANTHROPIC_API_KEY = new sst.Secret("ANTHROPIC_API_KEY")
|
|
const ANTHROPIC_API_KEY = new sst.Secret("ANTHROPIC_API_KEY")
|
|
|
const OPENAI_API_KEY = new sst.Secret("OPENAI_API_KEY")
|
|
const OPENAI_API_KEY = new sst.Secret("OPENAI_API_KEY")
|
|
|
const ZHIPU_API_KEY = new sst.Secret("ZHIPU_API_KEY")
|
|
const ZHIPU_API_KEY = new sst.Secret("ZHIPU_API_KEY")
|
|
|
-
|
|
|
|
|
const STRIPE_SECRET_KEY = new sst.Secret("STRIPE_SECRET_KEY")
|
|
const STRIPE_SECRET_KEY = new sst.Secret("STRIPE_SECRET_KEY")
|
|
|
const AUTH_API_URL = new sst.Linkable("AUTH_API_URL", {
|
|
const AUTH_API_URL = new sst.Linkable("AUTH_API_URL", {
|
|
|
properties: { value: auth.url.apply((url) => url!) },
|
|
properties: { value: auth.url.apply((url) => url!) },
|
|
@@ -91,6 +102,10 @@ export const gateway = new sst.cloudflare.Worker("GatewayApi", {
|
|
|
],
|
|
],
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+////////////////
|
|
|
|
|
+// CONSOLE
|
|
|
|
|
+////////////////
|
|
|
|
|
+
|
|
|
export const console = new sst.cloudflare.x.StaticSite("Console", {
|
|
export const console = new sst.cloudflare.x.StaticSite("Console", {
|
|
|
domain: `console.${domain}`,
|
|
domain: `console.${domain}`,
|
|
|
path: "cloud/web",
|
|
path: "cloud/web",
|