feat: make map key and signature optional

This commit is contained in:
Fredrik Thorsson
2024-08-13 11:24:06 +02:00
parent 242d604308
commit 02cd647649
2 changed files with 3 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ export default function StaticMap({
}: StaticMapProps) {
const key = env.GOOGLE_STATIC_MAP_KEY
const secret = env.GOOGLE_STATIC_MAP_SIGNATURE_SECRET
const safeSecret = decodeBase64Hash(removeWebSafe(secret))
const safeSecret = decodeBase64Hash(removeWebSafe(secret ?? ""))
const url = new URL(
`https://maps.googleapis.com/maps/api/staticmap?center=${city}&zoom=${zoomLevel}&size=${width}x${height}&maptype=${mapType}&key=${key}`

4
env/server.ts vendored
View File

@@ -58,8 +58,8 @@ export const env = createEnv({
SEAMLESS_LOGOUT_SV: z.string(),
WEBVIEW_ENCRYPTION_KEY: z.string(),
BOOKING_ENCRYPTION_KEY: z.string(),
GOOGLE_STATIC_MAP_KEY: z.string(),
GOOGLE_STATIC_MAP_SIGNATURE_SECRET: z.string(),
GOOGLE_STATIC_MAP_KEY: z.string().optional(),
GOOGLE_STATIC_MAP_SIGNATURE_SECRET: z.string().optional(),
},
emptyStringAsUndefined: true,
runtimeEnv: {