UNPKG

@elastic.io/maester-client

Version:
36 lines (35 loc) 1.35 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getContext = exports.creds = void 0; /* eslint-disable import/first */ process.env.LOG_LEVEL = 'INFO'; process.env.LOG_OUTPUT_MODE = 'short'; process.env.NODE_ENV = 'test'; const component_logger_1 = __importDefault(require("@elastic.io/component-logger")); const sinon_1 = __importDefault(require("sinon")); const fs_1 = require("fs"); const dotenv_1 = require("dotenv"); if ((0, fs_1.existsSync)('.env')) { (0, dotenv_1.config)(); const { ELASTICIO_OBJECT_STORAGE_TOKEN, ELASTICIO_OBJECT_STORAGE_URI, } = process.env; if (!ELASTICIO_OBJECT_STORAGE_TOKEN || !ELASTICIO_OBJECT_STORAGE_URI) { throw new Error('Please, provide all environment variables'); } } else { throw new Error('Please, provide environment variables to .env'); } const { ELASTICIO_OBJECT_STORAGE_TOKEN, ELASTICIO_OBJECT_STORAGE_URI } = process.env; exports.creds = { jwtSecret: ELASTICIO_OBJECT_STORAGE_TOKEN, uri: ELASTICIO_OBJECT_STORAGE_URI, userAgent: 'userAgent' }; const getContext = () => ({ logger: (0, component_logger_1.default)(), emit: sinon_1.default.spy(), }); exports.getContext = getContext;