Template
1
0

feat: add payment module

This commit is contained in:
2025-12-05 01:56:42 +01:00
parent a818f3135a
commit be9b8e9e55
160 changed files with 8615 additions and 1158 deletions

View File

@@ -1,6 +1,8 @@
import { join } from "node:path";
import { load } from "@std/dotenv";
const env = await load();
const env = await load({ envPath: getDotEnvPath(), export: true });
/**
* TODO ...
@@ -8,3 +10,11 @@ const env = await load();
export function getDotEnvVariable(key: string): string {
return env[key] ?? Deno.env.get(key);
}
function getDotEnvPath(): string {
const dirname = import.meta.dirname;
if (dirname === undefined) {
throw new Error("Unable to determine dirname in config");
}
return join(dirname, "..", "..", ".env");
}

View File

@@ -1,11 +1,9 @@
import { load } from "@std/dotenv";
import type { ZodType, z } from "zod";
import { getDotEnvVariable } from "./dotenv.ts";
import { InvalidEnvironmentKeyError } from "./errors.ts";
import { getServiceEnvironment, type ServiceEnvironment } from "./service.ts";
const env = await load();
/**
* TODO ...
*/
@@ -21,7 +19,7 @@ export function getEnvironmentVariable<TType extends ZodType>({
fallback?: string;
}): z.infer<TType> {
const serviceEnv = getServiceEnvironment();
const providedValue = env[key] ?? Deno.env.get(key);
const providedValue = getDotEnvVariable(key);
const fallbackValue = typeof envFallback === "object" ? (envFallback[serviceEnv] ?? fallback) : fallback;
const toBeUsed = providedValue ?? fallbackValue;
try {

View File

@@ -9,6 +9,6 @@
},
"dependencies": {
"@std/dotenv": "npm:@jsr/std__dotenv@0.225.5",
"zod": "4.1.12"
"zod": "4.1.13"
}
}