MCPcopy Index your code
hub / github.com/CapSoftware/Cap / createServerEnv

Function createServerEnv

packages/env/server.ts:12–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 .pipe(z.boolean());
11
12function createServerEnv() {
13 return createEnv({
14 server: {
15 /// General configuration
16 DATABASE_URL: z.string().describe("MySQL database URL"),
17 WEB_URL: z
18 .string()
19 .describe("Public URL of the server eg. https://cap.so"),
20 NEXTAUTH_SECRET: z.string().describe("32 byte base64 string"),
21 NEXTAUTH_URL: z.string().describe("Should be the same as WEB_URL"),
22 DATABASE_ENCRYPTION_KEY: z
23 .string()
24 .optional()
25 .describe(
26 "32 byte hex string for encrypting values like AWS access keys",
27 ),
28
29 // Cap uses Resend for email sending, including sending login code emails
30 RESEND_API_KEY: z.string().optional(),
31 RESEND_FROM_DOMAIN: z.string().optional(),
32
33 /// S3 configuration
34 // Though they are prefixed with `CAP_AWS`, these don't have to be
35 // for AWS, and can instead be for any S3-compatible service
36 CAP_AWS_BUCKET: z.string(),
37 CAP_AWS_REGION: z.string(),
38 CAP_AWS_ACCESS_KEY: z.string().optional(),
39 CAP_AWS_SECRET_KEY: z.string().optional(),
40 S3_PUBLIC_ENDPOINT: z
41 .string()
42 .optional()
43 .describe("Public endpoint for accessing S3"),
44 S3_INTERNAL_ENDPOINT: z
45 .string()
46 .optional()
47 .describe(
48 "Internal endpoint for accessing S3. This is useful if accessing S3 over public internet is more expensive than via your hosting environment's local network.",
49 ),
50 S3_PATH_STYLE: boolString(true).describe(
51 "Whether the bucket should be accessed using path-style URLs (common for non-AWS providers, eg. '/{bucket}/{key}') or virtual-hosted-style URLs (eg. '{bucket}.s3.amazonaws.com/{key}').",
52 ),
53
54 /// CloudFront configuration
55 // Configure these if you'd like to serve assets from the default bucket via CloudFront
56 // In this case, CAP_AWS_BUCKET_URL should be your CloudFront distribution's URL
57 CAP_AWS_BUCKET_URL: z
58 .string()
59 .optional()
60 .describe("Public URL of the S3 bucket"),
61 CAP_CLOUDFRONT_DISTRIBUTION_ID: z.string().optional(),
62 CLOUDFRONT_KEYPAIR_ID: z.string().optional(),
63 CLOUDFRONT_KEYPAIR_PRIVATE_KEY: z.string().optional(),
64
65 /// Google Auth
66 // Provide these to allow Google login
67 GOOGLE_CLIENT_ID: z.string().optional(),
68 GOOGLE_CLIENT_SECRET: z.string().optional(),
69

Callers 1

serverEnvFunction · 0.85

Calls 1

boolStringFunction · 0.85

Tested by

no test coverage detected