mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 07:27:58 +00:00
Add sandbox switch for dns made easy
This commit is contained in:
@@ -119,6 +119,7 @@ const envSchema = z
|
|||||||
})
|
})
|
||||||
.default("{}")
|
.default("{}")
|
||||||
),
|
),
|
||||||
|
DNS_MADE_EASY_SANDBOX_ENABLED: zodStrBool.default("false").optional(),
|
||||||
// smtp options
|
// smtp options
|
||||||
SMTP_HOST: zpStr(z.string().optional()),
|
SMTP_HOST: zpStr(z.string().optional()),
|
||||||
SMTP_IGNORE_TLS: zodStrBool.default("false"),
|
SMTP_IGNORE_TLS: zodStrBool.default("false"),
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import { crypto } from "@app/lib/crypto/cryptography";
|
|||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
||||||
|
import https from "https";
|
||||||
|
|
||||||
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { DNSMadeEasyConnectionMethod } from "./dns-made-easy-connection-enum";
|
import { DNSMadeEasyConnectionMethod } from "./dns-made-easy-connection-enum";
|
||||||
import {
|
import {
|
||||||
TDNSMadeEasyConnection,
|
TDNSMadeEasyConnection,
|
||||||
@@ -24,6 +26,11 @@ interface DNSMadeEasyApiResponse {
|
|||||||
page: number;
|
page: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getDNSMadeEasyUrl = (path: string) => {
|
||||||
|
const appCfg = getConfig();
|
||||||
|
return `${appCfg.DNS_MADE_EASY_SANDBOX_ENABLED ? IntegrationUrls.DNS_MADE_EASY_SANDBOX_API_URL : IntegrationUrls.DNS_MADE_EASY_API_URL}${path}`;
|
||||||
|
};
|
||||||
|
|
||||||
export const makeDNSMadeEasyAuthHeaders = (
|
export const makeDNSMadeEasyAuthHeaders = (
|
||||||
apiKey: string,
|
apiKey: string,
|
||||||
secretKey: string,
|
secretKey: string,
|
||||||
@@ -92,7 +99,11 @@ export const validateDNSMadeEasyConnectionCredentials = async (config: TDNSMadeE
|
|||||||
const { apiKey, secretKey } = config.credentials;
|
const { apiKey, secretKey } = config.credentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await request.get(`${IntegrationUrls.DNS_MADE_EASY_API_URL}/V2.0/dns/managed/`, {
|
const resp = await request.get(getDNSMadeEasyUrl("/V2.0/dns/managed/"), {
|
||||||
|
httpAgent: new https.Agent({
|
||||||
|
minVersion: "TLSv1.2",
|
||||||
|
maxVersion: "TLSv1.2"
|
||||||
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
...makeDNSMadeEasyAuthHeaders(apiKey, secretKey),
|
...makeDNSMadeEasyAuthHeaders(apiKey, secretKey),
|
||||||
Accept: "application/json"
|
Accept: "application/json"
|
||||||
|
|||||||
Reference in New Issue
Block a user