diff --git a/deno.json b/deno.json index 1081f4b..8e466fa 100644 --- a/deno.json +++ b/deno.json @@ -5,7 +5,7 @@ }, "fmt": { "exclude": ["LICENSE", ".github/**/*.md"] }, "tasks": { - "run": "deno run --allow-read='./public/,./private/cocktails.jsonc' --allow-net='0.0.0.0' --unstable-kv", + "run": "deno run --allow-env='API_URL' --allow-read='./public/,./private/cocktails.jsonc' --allow-net='0.0.0.0' --unstable-kv", "start": "deno task run src/server.ts", "dev": "deno task run --watch src/server.ts", "test": "deno test --allow-read='./public/,./private/cocktails.jsonc' --allow-net='0.0.0.0' --unstable-kv --parallel --shuffle" diff --git a/src/components/utils.ts b/src/components/utils.ts index e5cc294..024a614 100644 --- a/src/components/utils.ts +++ b/src/components/utils.ts @@ -1,9 +1,10 @@ import { hc } from "@hono/hono/client"; -import { API } from "../api/mod.ts"; -import { Cocktail } from "../api/utils/types.ts"; +import type { API } from "../api/mod.ts"; +import { Cocktail, Message } from "../api/utils/types.ts"; -const client = hc("http://0.0.0.0:8000/api"); +const url: string = Deno.env.get("API_URL") || "http://0.0.0.0:8000"; +const client = hc(`${url}/api`); /** * Get cocktails from the server