This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: all auth code has been removed for the sake of brevity. Please see part 2 of blog series | |
// for more info: https://liftcodeplay.com/2018/10/16/pushing-my-api-to-the-edge-part-2-authentication-and-authorization/ | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
const genderFemale = 'Female' | |
const genderMale = 'Male' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"divisions": [ | |
{ | |
"gender": "male", | |
"startAge": 14, | |
"endAge": 18, | |
"dateNumber": 1, | |
"dateMonth": 1, | |
"name": "Sub-Junior", | |
"abbrev": "SJ" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event)) | |
}) | |
/** | |
* Entry point of the worker | |
*/ | |
async function handleRequest(event) { | |
try { | |
// Get the JWT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace EventMgr.Functions.Events | |
{ | |
[DependencyInjectionConfig(typeof(DIConfig))] | |
public static class Attendee | |
{ | |
[FunctionName("Attendee")] | |
public static async Task<IActionResult> Run( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", "put", "delete", Route = "attendee")] | |
HttpRequest request, ILogger log, ExecutionContext context, | |
[Inject] IAttendeeRepository attendeeRepository, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"EventPermissions": [ | |
{ | |
"EventId": 6002, | |
"Role": "Admin", | |
"AllowedPermissions": [ | |
"All" | |
] | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
/** | |
* Fetch and log a request | |
* @param {Request} request | |
*/ | |
async function handleRequest(request) { | |
var currentDateTime = new Date() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/ | |
/** | |
* Fetch and log a request | |
* @param {Request} request | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Needed to talk to Cloudflare and by default Powershell uses a now-obsolete version of TLS (1.0?) | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
# We need these environment variables for the serverless step | |
[Environment]::SetEnvironmentVariable("CLOUDFLARE_AUTH_KEY", $args[0], "Process") # API key - get it from key vault | |
[Environment]::SetEnvironmentVariable("CLOUDFLARE_AUTH_EMAIL", $args[1], "Process") # Cloudflare email address for the API key - get it from key vault | |
# https://github.com/serverless/serverless | |
Write-Host "Deploying YAML using serverless NPM tool" | |
serverless deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"IsEncrypted": false, | |
"Values": { | |
"AzureWebJobsStorage": "UseDevelopmentStorage=true", | |
"AzureWebJobsDashboard": "UseDevelopmentStorage=true", | |
"FUNCTIONS_WORKER_RUNTIME": "dotnet" | |
}, | |
"ConnectionStrings": { | |
"MyDb": "<my connection string>" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Context = New-AzureStorageContext -StorageAccountName $(BlobServiceName) -StorageAccountKey $(WolfTrackerBlobKey) | |
$blobs = Get-AzureStorageBlob -Context $Context -Container $(WolfTrackerBlobContainer) | |
foreach ($blob in $blobs) | |
{ | |
Write-Host ("Removing Blob: {0}" -f $blob.Name) | |
Remove-AzureStorageBlob -ICloudBlob $blob.ICloudBlob -Context $Context | |
} |