Skip to content

server.psd1 doesn't reload when using custom properties after restart #1578

@helpimnotdrowning

Description

@helpimnotdrowning

Describe the Bug

Restarting the server with Ctrl+R does not reload the server.psd1 when it has custom properties, at least when at the root.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Save the following to a ps1 file:
Import-Module Pode

Start-PodeServer -RootPath $PSScriptRoot {
    Add-PodeEndpoint -Port 8080 -Protocol HTTP
    
    Add-PodeRoute -Path '/' -Method GET -ScriptBlock {
        (Get-PodeConfig) | ConvertTo-Json -Dep 3 | Write-Host
    }
}
  1. Save the following to the server.psd1 file:
@{
	# CustomProp = @{ }
	
	Web = @{
		Compression = @{
			Enable = $false
		}
	}
}
  1. Start the server
  2. Open or request localhost:8080/
  3. See in the terminal that Web.Compression.Enable is false.
  4. In the server.psd1 file, change $false to $true, then reload the server with Ctrl+R
  5. Open the page again and see that Web.Compression.Enable is now true. (expected)
  6. Now, shut down the server completely and uncomment the CustomProp line.
  7. Start the server, open the page and see that Web.Compression.Enable is still true. (expected)
  8. Change $true to $false and reload the server.
  9. Open the page. Despite being changed, Web.Compression.Enable is still true. (unexpected)

Expected Behavior

The final change should be loaded.

Platform

  • OS: Linux, Debian 12
  • Browser: Firefox 140
  • Versions:
    • Pode: Pode 2.12.1
    • PowerShell: PowerShell 7.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions