mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
⭐ feat(api): Add payments with Polar.sh (#264)
## Description <!-- Briefly describe the purpose and scope of your changes --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new subscription API endpoint for managing subscriptions and products. - Enhanced subscription management with new entities and functionalities. - Added functionality to retrieve current timestamps in both local and UTC formats. - Added Polar.sh integration with customer portal and checkout session creation APIs. - **Refactor** - Redesigned team details to now present members and subscription information instead of a plan type. - Enhanced member management by incorporating role assignments. - Streamlined user data handling and removed legacy subscription event logic. - Simplified error handling in actor functions for better clarity. - Updated plan types and UI labels to reflect new subscription tiers. - Improved database indexing for Steam user data. - **Chores** - Updated the database schema with new tables and fields to support subscription, team, and member enhancements. - Extended identifier prefixes to broaden system integration. - Added new secrets related to pricing plans in infrastructure configuration. - Configured API and auth routing with new domain and routing rules. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,26 +1,14 @@
|
||||
import { bus } from "./bus";
|
||||
import { domain } from "./dns";
|
||||
// import { email } from "./email";
|
||||
import { secret } from "./secret";
|
||||
import { postgres } from "./postgres";
|
||||
import { cluster } from "./cluster";
|
||||
// sst.Linkable.wrap(random.RandomString, (resource) => ({
|
||||
// properties: {
|
||||
// value: resource.result,
|
||||
// },
|
||||
// }));
|
||||
|
||||
// export const authFingerprintKey = new random.RandomString(
|
||||
// "AuthFingerprintKey",
|
||||
// {
|
||||
// length: 32,
|
||||
// },
|
||||
// );
|
||||
import { postgres } from "./postgres";
|
||||
|
||||
//FIXME: Use a shared /tmp folder
|
||||
export const auth = new sst.aws.Service("Auth", {
|
||||
cluster,
|
||||
cpu: $app.stage === "production" ? "1 vCPU" : undefined,
|
||||
memory: $app.stage === "production" ? "2 GB" : undefined,
|
||||
cluster,
|
||||
command: ["bun", "run", "./src/auth.ts"],
|
||||
link: [
|
||||
bus,
|
||||
@@ -38,18 +26,12 @@ export const auth = new sst.aws.Service("Auth", {
|
||||
NO_COLOR: "1",
|
||||
STORAGE: $dev ? "/tmp/persist.json" : "/mnt/efs/persist.json"
|
||||
},
|
||||
//TODO: Use API gateway instead, because of the API headers
|
||||
loadBalancer: {
|
||||
domain: "auth." + domain,
|
||||
rules: [
|
||||
{
|
||||
listen: "80/http",
|
||||
forward: "3002/http",
|
||||
},
|
||||
{
|
||||
listen: "443/https",
|
||||
forward: "3002/http",
|
||||
},
|
||||
],
|
||||
},
|
||||
permissions: [
|
||||
@@ -70,4 +52,15 @@ export const auth = new sst.aws.Service("Auth", {
|
||||
max: 10,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
export const authRoute = new sst.aws.Router("AuthRoute", {
|
||||
routes: {
|
||||
// I think auth.url should work all the same
|
||||
"/*": auth.nodes.loadBalancer.dnsName,
|
||||
},
|
||||
domain: {
|
||||
name: "auth." + domain,
|
||||
dns: sst.cloudflare.dns(),
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user