Skip to content
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
2 changes: 1 addition & 1 deletion PSModuleDevelopment/PSModuleDevelopment.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Version number of this module.

ModuleVersion = '2.2.11.163'
ModuleVersion = '2.2.11.168'

# ID used to uniquely identify this module
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'
Expand Down
8 changes: 8 additions & 0 deletions PSModuleDevelopment/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.2.11.168 (2024-05-31)

+ Upd: Template AzureFunction - added config option to override http Endpoint methods (#198)
+ Upd: Template AzureFunction - updated host.json to include some default headers (#197)
+ Fix: Template AzureFunction - build script ignores some overrides due to typo (#199)
+ Fix: Template AzureFunction - build fails when executing without the String module loaded (#196)
+ Fix: Template MiniModule - Automatically adds wrong github sponsor accountname

## 2.2.11.163 (2024-02-25)

+ New: Template ApplockerPipeline - A project that can be used to generate AppLocker policies across environments
Expand Down
2 changes: 1 addition & 1 deletion templates/AzureFunction/PSMDTemplate.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
TemplateName = 'AzureFunction'
Version = "2.0.0"
Version = "2.0.5"
AutoIncrementVersion = $true
Tags = 'azure', 'function'
Author = 'Friedrich Weinmann'
Expand Down
4 changes: 4 additions & 0 deletions templates/AzureFunction/build/build.config.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
AuthLevelOverrides = @{
# 'Set-Foo' = 'anonymous'
}
Methods = @('get', 'post')
MethodOverrides = @{
# 'Set-Foo' = 'delete'
}
}
}
22 changes: 13 additions & 9 deletions templates/AzureFunction/build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,29 @@ $commands = Get-ChildItem -Path "$($buildFolder.FullName)/modules/þnameþ/Funct
Update-ModuleManifest -Path "$($buildFolder.FullName)/modules/þnameþ/þnameþ.psd1" -FunctionsToExport $commands

# Generate Http Trigger
$httpCode = Get-Content -Path "$PSScriptRoot\functionHttp\run.ps1" | Join-String "`n"
$httpConfig = Get-Content -Path "$PSScriptRoot\functionHttp\function.json" | Join-String "`n"
$httpCode = Get-Content -Path "$PSScriptRoot\functionHttp\run.ps1" | Join-String -Separator "`n"
$httpConfig = Get-Content -Path "$PSScriptRoot\functionHttp\function.json" | Join-String -Separator "`n"
foreach ($command in Get-ChildItem -Path "$workingDirectory\þnameþ\functions\httpTrigger" -Recurse -File -Filter *.ps1) {
$authLevel = $config.HttpTrigger.AuthLevel
if ($config.HttpTrigger.AuthLevelOverride.$($command.BaseName)) {
$authLevel = $config.HttpTrigger.AuthLevelOverride.$($command.BaseName)
if ($config.HttpTrigger.AuthLevelOverrides.$($command.BaseName)) {
$authLevel = $config.HttpTrigger.AuthLevelOverrides.$($command.BaseName)
}
$methods = $config.HttpTrigger.Methods
if ($config.HttpTrigger.MethodOverrides.$($command.BaseName)) {
$methods = $config.HttpTrigger.MethodOverrides.$($command.BaseName)
}
$endpointFolder = New-Item -Path $buildFolder.FullName -Name $command.BaseName -ItemType Directory
$httpCode -replace '%COMMAND%',$command.BaseName | Set-Content -Path "$($endpointFolder.FullName)\run.ps1"
$httpConfig -replace '%AUTHLEVEL%', $authLevel | Set-Content -Path "$($endpointFolder.FullName)\function.json"
$httpConfig -replace '%AUTHLEVEL%', $authLevel -replace '%METHODS%', ($methods -join '", "') | Set-Content -Path "$($endpointFolder.FullName)\function.json"
}

# Generate Timer Trigger
$timerCode = Get-Content -Path "$PSScriptRoot\functionTimer\run.ps1" | Join-String "`n"
$timerConfig = Get-Content -Path "$PSScriptRoot\functionTimer\function.json" | Join-String "`n"
$timerCode = Get-Content -Path "$PSScriptRoot\functionTimer\run.ps1" | Join-String -Separator "`n"
$timerConfig = Get-Content -Path "$PSScriptRoot\functionTimer\function.json" | Join-String -Separator "`n"
foreach ($command in Get-ChildItem -Path "$workingDirectory\þnameþ\functions\timerTrigger" -Recurse -File -Filter *.ps1) {
$schedule = $config.TimerTrigger.Schedule
if ($config.TimerTrigger.ScheduleOverride.$($command.BaseName)) {
$schedule = $config.TimerTrigger.ScheduleOverride.$($command.BaseName)
if ($config.TimerTrigger.ScheduleOverrides.$($command.BaseName)) {
$schedule = $config.TimerTrigger.ScheduleOverrides.$($command.BaseName)
}
$endpointFolder = New-Item -Path $buildFolder.FullName -Name $command.BaseName -ItemType Directory
$timerCode -replace '%COMMAND%',$command.BaseName | Set-Content -Path "$($endpointFolder.FullName)\run.ps1"
Expand Down
3 changes: 1 addition & 2 deletions templates/AzureFunction/build/functionHttp/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"direction": "in",
"name": "Request",
"methods": [
"get",
"post"
"%METHODS%"
]
},
{
Expand Down
25 changes: 21 additions & 4 deletions templates/AzureFunction/function/host.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
{
"version": "2.0",
"managedDependency": {
"Enabled": true
}
"version": "2.0",
"extensions": {
"http": {
"routePrefix": "api",
"customHeaders": {
"Content-Security-Policy": "default-src 'self'",
"Permissions-Policy": "geolocation=()",
"X-Frame-Options": "SAMEORIGIN",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"Referrer-Policy": "no-referrer"
}
}
},
"managedDependency": {
"enabled": true
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
}
3 changes: 1 addition & 2 deletions templates/MiniModule/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# These are supported funding model platforms

github:
FriedrichWeinmann
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down