Skip to content

Commit 60459f5

Browse files
Merge pull request #201 from PowershellFrameworkCollective/development
2.2.11.168
2 parents 148ad95 + 90ce200 commit 60459f5

File tree

8 files changed

+50
-19
lines changed

8 files changed

+50
-19
lines changed

PSModuleDevelopment/PSModuleDevelopment.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Version number of this module.
77

8-
ModuleVersion = '2.2.11.163'
8+
ModuleVersion = '2.2.11.168'
99

1010
# ID used to uniquely identify this module
1111
GUID = '37dd5fce-e7b5-4d57-ac37-832055ce49d6'

PSModuleDevelopment/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 2.2.11.168 (2024-05-31)
4+
5+
+ Upd: Template AzureFunction - added config option to override http Endpoint methods (#198)
6+
+ Upd: Template AzureFunction - updated host.json to include some default headers (#197)
7+
+ Fix: Template AzureFunction - build script ignores some overrides due to typo (#199)
8+
+ Fix: Template AzureFunction - build fails when executing without the String module loaded (#196)
9+
+ Fix: Template MiniModule - Automatically adds wrong github sponsor accountname
10+
311
## 2.2.11.163 (2024-02-25)
412

513
+ New: Template ApplockerPipeline - A project that can be used to generate AppLocker policies across environments

templates/AzureFunction/PSMDTemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
TemplateName = 'AzureFunction'
3-
Version = "2.0.0"
3+
Version = "2.0.5"
44
AutoIncrementVersion = $true
55
Tags = 'azure', 'function'
66
Author = 'Friedrich Weinmann'

templates/AzureFunction/build/build.config.psd1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,9 @@
2222
AuthLevelOverrides = @{
2323
# 'Set-Foo' = 'anonymous'
2424
}
25+
Methods = @('get', 'post')
26+
MethodOverrides = @{
27+
# 'Set-Foo' = 'delete'
28+
}
2529
}
2630
}

templates/AzureFunction/build/build.ps1

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,29 @@ $commands = Get-ChildItem -Path "$($buildFolder.FullName)/modules/þnameþ/Funct
2828
Update-ModuleManifest -Path "$($buildFolder.FullName)/modules/þnameþ/þnameþ.psd1" -FunctionsToExport $commands
2929

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

4347
# Generate Timer Trigger
44-
$timerCode = Get-Content -Path "$PSScriptRoot\functionTimer\run.ps1" | Join-String "`n"
45-
$timerConfig = Get-Content -Path "$PSScriptRoot\functionTimer\function.json" | Join-String "`n"
48+
$timerCode = Get-Content -Path "$PSScriptRoot\functionTimer\run.ps1" | Join-String -Separator "`n"
49+
$timerConfig = Get-Content -Path "$PSScriptRoot\functionTimer\function.json" | Join-String -Separator "`n"
4650
foreach ($command in Get-ChildItem -Path "$workingDirectory\þnameþ\functions\timerTrigger" -Recurse -File -Filter *.ps1) {
4751
$schedule = $config.TimerTrigger.Schedule
48-
if ($config.TimerTrigger.ScheduleOverride.$($command.BaseName)) {
49-
$schedule = $config.TimerTrigger.ScheduleOverride.$($command.BaseName)
52+
if ($config.TimerTrigger.ScheduleOverrides.$($command.BaseName)) {
53+
$schedule = $config.TimerTrigger.ScheduleOverrides.$($command.BaseName)
5054
}
5155
$endpointFolder = New-Item -Path $buildFolder.FullName -Name $command.BaseName -ItemType Directory
5256
$timerCode -replace '%COMMAND%',$command.BaseName | Set-Content -Path "$($endpointFolder.FullName)\run.ps1"

templates/AzureFunction/build/functionHttp/function.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"direction": "in",
77
"name": "Request",
88
"methods": [
9-
"get",
10-
"post"
9+
"%METHODS%"
1110
]
1211
},
1312
{
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
{
2-
"version": "2.0",
3-
"managedDependency": {
4-
"Enabled": true
5-
}
2+
"version": "2.0",
3+
"extensions": {
4+
"http": {
5+
"routePrefix": "api",
6+
"customHeaders": {
7+
"Content-Security-Policy": "default-src 'self'",
8+
"Permissions-Policy": "geolocation=()",
9+
"X-Frame-Options": "SAMEORIGIN",
10+
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
11+
"X-Content-Type-Options": "nosniff",
12+
"Referrer-Policy": "no-referrer"
13+
}
14+
}
15+
},
16+
"managedDependency": {
17+
"enabled": true
18+
},
19+
"extensionBundle": {
20+
"id": "Microsoft.Azure.Functions.ExtensionBundle",
21+
"version": "[3.*, 4.0.0)"
22+
}
623
}

templates/MiniModule/.github/FUNDING.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# These are supported funding model platforms
22

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

0 commit comments

Comments
 (0)