Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Oct 11, 2023
1 parent ba48d7d commit b8a5733
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"semantic-release": "semantic-release",
"semantic-release-dry": "semantic-release --dry-run --no-ci --branches $CIRCLE_BRANCH",
"build": "hedy -v --test-bundle",
"deploy": "hedy -v --deploy --test",
"deploy": "hedy -v --deploy --test --aws-region=us-east-1",
"deploy-routes": "hedy --no-build -no-hints -l major",
"deploy-ci": "hedy -v --deploy --test --pkgVersion=ci$CIRCLE_BUILD_NUM -l ci --cleanup-ci=24h",
"deploy-secrets": "hedy --aws-update-secrets --params-file=secrets/secrets.env",
Expand Down
16 changes: 11 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ import secrets from '@adobe/helix-shared-secrets';
import wrap from '@adobe/helix-shared-wrap';
import { logger } from '@adobe/helix-universal-logger';
import { helixStatus } from '@adobe/helix-status';
import { Response } from '@adobe/fetch';

const DB = require('./db');
const PSIClient = require('./psi-client');

/**
* This is the main function
* @param {Request} request the request object (see fetch api)
* @param {UniversalContext} context the context of the universal serverless function
* @returns {Response} a response
*/
function run(request, context) {
const name = new URL(request.url).searchParams.get('name') || process.env.SECRET;
context.log.info(`Saying hello to: ${name}.`);
return new Response(`Hello, ${name}.`);
async function run(request, context) {
const db = DB({ region: process.env.REGION, accessKeyId: process.env.ACCESS_KEY_ID, secretAccessKey: process.env.SECRET_ACCESS_KEY });
const psiClient = PSIClient({
apiKey: process.env.PAGESPEED_API_KEY,
baseUrl: process.env.PAGESPEED_API_BASE_URL,
});
const auditResult = await psiClient.runAudit('https://www.bamboohr.com/');
await db.saveAuditIndex(auditResult);
}

export const main = wrap(run)
Expand Down

0 comments on commit b8a5733

Please sign in to comment.