import { __awaiter } from "tslib";
import Cloudflare from "cloudflare";
import getConfig from "next/config";
const { serverRuntimeConfig } = getConfig();
const cloudflare = new Cloudflare({
    token: serverRuntimeConfig.cloudflareToken,
});
export default function handler(req, res) {
    return __awaiter(this, void 0, void 0, function* () {
        const { address } = req.body;
        // eslint-disable-next-line @typescript-eslint/no-unused-vars -- might use the response later
        const response = yield cloudflare.dnsRecords.add(serverRuntimeConfig.cloudflareZoneID || "", {
            content: serverRuntimeConfig.cloudflareRecordIP || "",
            name: address + "-apps",
            ttl: 3600,
            proxied: true,
            type: "A",
        });
        res.status(200).json({ status: "ok" });
    });
}
//# sourceMappingURL=add-domain.js.map