afip.ts-fork-ssl-fix
Version:
Afip typescript SDK
32 lines • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Environment = void 0;
const dotenv_1 = require("dotenv");
class Environment {
constructor() {
(0, dotenv_1.config)();
this.testCredentialsFolder = process.env.TEST_CREDENTIALS_FOLDER;
this.testPrivateKeyFileName = process.env
.TEST_PRIVATE_KEY_FILE_NAME;
this.testCertFileName = process.env.TEST_CERT_FILE_NAME;
this.nodeEnv = (process.env.NODE_ENV || "local");
}
checkEnv() {
try {
if (!this.testCredentialsFolder)
throw new Error("TEST_CREDENTIALS_FOLDER");
if (!this.testPrivateKeyFileName)
throw new Error("TEST_PRIVATE_KEY_FILE_NAME");
if (!this.testCertFileName)
throw new Error("TEST_CERT_FILE_NAME");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}
catch (error) {
throw new Error(`Env parameter not defined on .env file: ${error.message}`);
}
}
}
exports.Environment = Environment;
const Env = new Environment();
exports.default = Env;
//# sourceMappingURL=env.js.map