| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import { type Context, type Handler } from "aws-lambda";
- import config from "./config";
- import { handler as chilecultura } from "./portales/chilecultura/handler";
- import { handler as ciper } from "./portales/ciper/handler";
- import { handler as codexverde } from "./portales/codexverde/handler";
- import { handler as contrapoder } from "./portales/contrapoder/handler";
- // import { handler as cooperativa } from "./portales/cooperativa/handler";
- import { handler as df } from "./portales/df/handler";
- import { handler as elciudadano } from "./portales/elciudadano/handler";
- import { handler as eldesconcierto } from "./portales/eldesconcierto/handler";
- import { handler as elmostrador } from "./portales/elmostrador/handler";
- import { handler as fastcheck } from "./portales/fastcheck/handler";
- import { handler as glaciareschilenos } from "./portales/glaciareschilenos/handler";
- import { handler as emol } from "./portales/emol/handler";
- import { handler as interferencia } from "./portales/interferencia/handler";
- import { handler as laderasur } from "./portales/laderasur/handler";
- import { handler as latercera } from "./portales/latercera/handler";
- // import { handler as metrodesantiago } from "./portales/metrodesantiago/handler";
- import { handler as tarreo } from "./portales/tarreo/handler";
- import { handler as theclinic } from "./portales/theclinic/handler";
- const context: Context = {
- callbackWaitsForEmptyEventLoop: false,
- functionName: "",
- functionVersion: "",
- invokedFunctionArn: "",
- memoryLimitInMB: "0",
- awsRequestId: "",
- logGroupName: "",
- logStreamName: "",
- done: () => { },
- fail: () => { },
- succeed: () => { },
- getRemainingTimeInMillis: () => 1
- };
- const portalsHandlers = {
- "chilecultura": chilecultura,
- "ciper": ciper,
- "codexverde": codexverde,
- "contrapoder": contrapoder,
- // "cooperativa": cooperativa,
- "df": df,
- "elciudadano": elciudadano,
- "eldesconcierto": eldesconcierto,
- "elmostrador": elmostrador,
- "emol": emol,
- "fastcheck": fastcheck,
- "glaciareschilenos": glaciareschilenos,
- "interferencia": interferencia,
- "laderasur": laderasur,
- "latercera": latercera,
- // "metrodesantiago": metrodesantiago,
- "tarreo": tarreo,
- "theclinic": theclinic
- };
- const activePortalsHandlers: Array<Handler> = Object.keys(portalsHandlers)
- .filter((portalName) => !config.DEVELOP || config.DEV_ACTIVE_PORTALS.includes(portalName))
- .map((portalName) => portalsHandlers[portalName]);
- const cooldown = 10000; // 10 seconds
- async function main(): Promise<void> {
- console.log(`${activePortalsHandlers}`)
- for (const portalHandler of activePortalsHandlers) {
- await portalHandler(null, context, () => { });
- await new Promise((resolve) => setTimeout(resolve, cooldown));
- }
- }
- main()
- .catch((err) => {
- console.error(err)
- })
- .finally(() => {
- process.exit(0);
- });
|