chore: change util import

This commit is contained in:
shiftinv 2022-09-03 20:14:57 +02:00
parent c60a5ad871
commit 2021afd969
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import * as util from "./util.ts";
import { parseBool } from "./util.ts";
function get(key: string, def?: string): string {
const value = Deno.env.get(key) ?? def;
@ -9,7 +9,7 @@ function get(key: string, def?: string): string {
}
export default {
debug: util.parseBool(get("DEBUG", "0")),
debug: parseBool(get("DEBUG", "0")),
hostname: get("HOSTNAME", "127.0.0.1"),
port: parseInt(get("PORT", "8080")),
signKey: get("SIGN_KEY"),

View File

@ -2,7 +2,7 @@ import { http, log } from "../deps.ts";
import { verify } from "./crypto.ts";
import filterWebhook from "./filter.ts";
import { UrlConfig } from "./types.d.ts";
import * as util from "./util.ts";
import { parseBool } from "./util.ts";
import { sendWebhook } from "./webhook.ts";
export default async function handle(req: Request): Promise<Response> {
@ -48,7 +48,7 @@ function getUrlConfig(params: URLSearchParams): UrlConfig {
config.allowBranches = value.split(",");
break;
case "hideTags":
config.hideTags = util.parseBool(value);
config.hideTags = parseBool(value);
break;
case "commentBurstLimit":
config.commentBurstLimit = parseInt(value);

View File

@ -1,6 +1,6 @@
import { log } from "../deps.ts";
import config from "./config.ts";
import * as util from "./util.ts";
import { sleep } from "./util.ts";
export async function sendWebhook(
id: string,
@ -35,7 +35,7 @@ export async function sendWebhook(
// wait and try again
log.warning(`retrying after ${resetms}ms`);
await util.sleep(resetms);
await sleep(resetms);
retries++;
} while (retries <= config.maxWebhookRetries);
return res;