feat: add SILVERBULLET_SERVER env variable

This commit is contained in:
max_richter 2023-07-26 13:57:13 +02:00
parent 917ea70f13
commit 67db6dc9af

View File

@ -3,6 +3,8 @@ import remarkParse from "npm:remark-parse";
import remarkFrontmatter from "https://esm.sh/remark-frontmatter@4";
import { parse } from "https://deno.land/std@0.194.0/yaml/mod.ts";
const SILVERBULLET_SERVER = Deno.env.get("SILVERBULLET_SERVER");
export type Document = {
name: string;
lastModified: number;
@ -19,7 +21,7 @@ export async function getDocuments(): Promise<Document[]> {
const headers = new Headers();
headers.append("Accept", "application/json");
const response = await fetch("http://192.168.178.56:3007/index.json", {
const response = await fetch(SILVERBULLET_SERVER + "/index.json", {
headers: headers,
});
@ -27,7 +29,7 @@ export async function getDocuments(): Promise<Document[]> {
}
export async function getDocument(name: string): Promise<string> {
const response = await fetch("http://192.168.178.56:3007/" + name);
const response = await fetch(SILVERBULLET_SERVER + name);
return await response.text();
}