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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user