mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
## 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** - Centralized and standardized error response schemas for APIs. - Utility functions for result formatting and enhanced validation error handling. - New utility modules for authentication and OAuth provider handling. - Added Discord OAuth user data fetching with email verification. - **Bug Fixes** - Improved error safety in cloud task creation by preventing potential runtime errors. - **Refactor** - Major simplification and reorganization of API routes and authentication logic. - Migration from valibot to zod for schema validation. - Streamlined import paths and consolidated utility exports. - Simplified TypeScript and .gitignore configuration for easier maintenance. - Disabled machine authentication provider and related logic. - **Chores** - Removal of unused or deprecated API endpoints, database migration, and permissions deployment code. - Updated package dependencies and scripts for improved reliability and performance. - Enhanced documentation and updated project metadata. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import { bus } from "./bus";
|
|
import { domain } from "./dns";
|
|
import { secret } from "./secret";
|
|
import { cluster } from "./cluster";
|
|
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,
|
|
command: ["bun", "run", "./src/auth/index.ts"],
|
|
link: [
|
|
bus,
|
|
postgres,
|
|
secret.PolarSecret,
|
|
secret.GithubClientID,
|
|
secret.DiscordClientID,
|
|
secret.GithubClientSecret,
|
|
secret.DiscordClientSecret,
|
|
],
|
|
image: {
|
|
dockerfile: "packages/functions/Containerfile",
|
|
},
|
|
environment: {
|
|
NO_COLOR: "1",
|
|
STORAGE: $dev ? "/tmp/persist.json" : "/mnt/efs/persist.json"
|
|
},
|
|
loadBalancer: {
|
|
rules: [
|
|
{
|
|
listen: "80/http",
|
|
forward: "3002/http",
|
|
},
|
|
],
|
|
},
|
|
permissions: [
|
|
{
|
|
actions: ["ses:SendEmail"],
|
|
resources: ["*"],
|
|
},
|
|
],
|
|
dev: {
|
|
command: "bun dev:auth",
|
|
directory: "packages/functions",
|
|
url: "http://localhost:3002",
|
|
},
|
|
scaling:
|
|
$app.stage === "production"
|
|
? {
|
|
min: 2,
|
|
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(),
|
|
},
|
|
}) |