refactor: ♻️emoves Env parameter

Removes the `Env` parameter from several functions to simplify their signatures and rely on the global `env` for configuration.

This change reduces the number of arguments passed around, making the code cleaner and easier to maintain.
This commit is contained in:
2025-08-10 19:22:14 -04:00
parent 0b0078328c
commit 8175d73df1
26 changed files with 8716 additions and 184 deletions

View File

@@ -1,13 +1,12 @@
import { env as cloudflareEnv } from "cloudflare:workers";
import mapKeys from "lodash.mapkeys";
import type { Env } from "~/types/env";
import { Case, changeStringCase } from "../changeStringCase";
import { readEnvVariable } from "../readEnvVariable";
export function getAdminSdkCredentials(env: Env) {
export function getAdminSdkCredentials(env: Cloudflare.Env = cloudflareEnv) {
return mapKeys(
readEnvVariable<AdminSdkCredentials>(env, "ADMIN_SDK_JSON"),
readEnvVariable<AdminSdkCredentials>("ADMIN_SDK_JSON", env),
(_, key) => changeStringCase(key, Case.snake_case, Case.camelCase),
) as unknown as AdminSdkCredentials;
}