Create your Link in Bio for Bluesky

環境変数のデフォルト値を実装側に移動

Changed files
+15 -17
app
utils
-7
.env.example
··· 1 - # bsky 2 - BSKY_PUBLIC_API_URL=http://localhost:2584 3 - BSKY_FIREHOSE_URL=ws://localhost:2583 4 - 5 - # atproto 6 - ATPROTO_PCL_URL=http://localhost:2582 7 - 8 1 # prisma 9 2 DATABASE_URL=postgresql://postgres:password@localhost:5432/linkat
+15 -4
app/utils/env.ts
··· 1 1 import { createEnv } from "@t3-oss/env-core"; 2 2 import { z } from "zod"; 3 3 4 + const prod = process.env.NODE_ENV === "production"; 5 + 4 6 const server = { 5 7 NODE_ENV: z 6 8 .enum(["development", "production", "test"]) 7 9 .default(process.env.NODE_ENV), 8 10 LOG_LEVEL: z 9 11 .enum(["debug", "info", "warn", "error"]) 10 - .default(process.env.NODE_ENV === "production" ? "info" : "debug"), 12 + .default(prod ? "info" : "debug"), 11 13 DATABASE_URL: z.string(), 12 - BSKY_PUBLIC_API_URL: z.string().url(), 13 - BSKY_FIREHOSE_URL: z.string().url(), 14 - ATPROTO_PCL_URL: z.string().url(), 14 + BSKY_PUBLIC_API_URL: z 15 + .string() 16 + .url() 17 + .default(prod ? "https://public.api.bsky.app" : "http://localhost:2584"), 18 + BSKY_FIREHOSE_URL: z 19 + .string() 20 + .url() 21 + .default(prod ? "wss://bsky.network" : "ws://localhost:2583"), 22 + ATPROTO_PCL_URL: z 23 + .string() 24 + .url() 25 + .default(prod ? "https://plc.directory" : "http://localhost:2582"), 15 26 }; 16 27 17 28 export const env = (() => {
-6
fly.toml
··· 12 12 release_command = 'npx prisma db push --skip-generate' 13 13 strategy = 'bluegreen' 14 14 15 - [env] 16 - BSKY_FIREHOSE_URL = 'wss://bsky.network' 17 - BSKY_PUBLIC_API_URL = 'https://public.api.bsky.app' 18 - DID_PCL_URL = 'https://plc.directory' 19 - LOG_LEVEL = 'info' 20 - 21 15 [http_service] 22 16 internal_port = 3000 23 17 force_https = true