Skip to content

Commit

Permalink
try interpolating username
Browse files Browse the repository at this point in the history
  • Loading branch information
gidsg committed Dec 23, 2024
1 parent c4887c5 commit 213b5bb
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ Resources:
Properties:
Name: EnforceBasicAuth
FunctionConfig:
Comment: A basic CloudFront function
Comment: A CloudFront function to enforce basic auth
Runtime: cloudfront-js-2.0
FunctionCode: |
function handler(event) {
// NOTE: This example function is for a viewer request event trigger.
// Choose viewer request for the event trigger when you associate this function with a distribution.
var response = {
statusCode: 200,
statusDescription: 'OK',
headers: {
'cloudfront-functions': { value: 'generated-by-CloudFront-Functions' }
}
};
return response;
}
FunctionCode:
!Sub |
function handler(event) {
const username = ${AWS::NoValue}${!SSM[/copilot/${App}/${Env}/secrets/BASIC_AUTH_USERNAME}
// NOTE: This example function is for a viewer request event trigger.
// Choose viewer request for the event trigger when you associate this function with a distribution.
var response = {
statusCode: 200,
statusDescription: 'OK',
headers: {
'cloudfront-functions': { value: 'generated-by-CloudFront-Functions' }
}
};
return response;
}
AutoPublish: false

0 comments on commit 213b5bb

Please sign in to comment.