Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

122: Adding x-api-key for data register integration. #275

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lambda/nameUpdate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const AWS = require("aws-sdk");
const { runQuery, runScan, NAME_CACHE_TABLE_NAME, TABLE_NAME, ORCS_INDEX, dynamodb } = require("../dynamoUtil");
const { logger } = require('../logger');
const DATA_REGISTER_NAME_ENDPOINT = process.env.DATA_REGISTER_NAME_ENDPOINT || 'https://zloys5cfvf.execute-api.ca-central-1.amazonaws.com/api/parks/names?status=current';
const DATA_REGISTER_NAME_API_KEY = process.env.DATA_REGISTER_NAME_API_KEY;

exports.handler = async (event, context) => {
logger.info('Name Update')
Expand Down Expand Up @@ -211,7 +212,8 @@ async function getDataRegisterRecords() {
headers: {
'Content-Type': 'application/json',
'Authorization': 'None',
'Accept': 'application/json'
'Accept': 'application/json',
'x-api-key': DATA_REGISTER_NAME_API_KEY
}
});
}
Expand Down
1 change: 1 addition & 0 deletions terraform/src/nameUpdate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resource "aws_lambda_function" "name_update" {
TABLE_NAME = aws_dynamodb_table.ar_table.name,
NAME_CACHE_TABLE_NAME = aws_dynamodb_table.ar_table_name_cache.name,
DATA_REGISTER_NAME_ENDPOINT = data.aws_ssm_parameter.data_register_name_endpoint.value,
DATA_REGISTER_NAME_API_KEY = data.aws_ssm_parameter.data_register_name_api_key.value,
LOG_LEVEL = "debug"
}
}
Expand Down
4 changes: 4 additions & 0 deletions terraform/src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ data "aws_ssm_parameter" "data_register_name_endpoint" {
name = "/parks-ar-api/data-register-name-endpoint"
}

data "aws_ssm_parameter" "data_register_name_api_key" {
name = "/parks-ar-api/data-register-name-api-key"
}

data "aws_ssm_parameter" "s3_bucket_assets" {
name = "/parks-ar-api/s3-bucket-assets"
}
Expand Down