< Summary - Kestrun — Combined Coverage

Information
Class: Public.Helper.Set-KrEnvironment
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Set-KrEnvironment.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 42
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 10/13/2025 - 16:52:37 Line coverage: 0% (0/5) Total lines: 42 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Helper/Set-KrEnvironment.ps1

#LineLine coverage
 1
 2<#
 3.SYNOPSIS
 4    Sets the Kestrun environment for the current PowerShell session.
 5.DESCRIPTION
 6    Sets the Kestrun environment for the current PowerShell session.
 7    This affects how Kestrun behaves, for example in terms of error handling and logging.
 8.PARAMETER Name
 9    The name of the environment to set. Valid values are 'Development', 'Staging', and 'Production'.
 10.PARAMETER WhatIf
 11    Shows what would happen if the cmdlet runs. The cmdlet is not run.
 12.PARAMETER Confirm
 13    Prompts you for confirmation before running the cmdlet.
 14.OUTPUTS
 15    The name of the currently set environment after applying the change.
 16.EXAMPLE
 17    Set-KrEnvironment -Name 'Development'
 18    Sets the Kestrun environment to 'Development'.
 19    This enables detailed error messages and logging for development purposes.
 20.EXAMPLE
 21    Set-KrEnvironment -Name 'Production'
 22    Sets the Kestrun environment to 'Production'.
 23    This enables optimized settings for a production environment.
 24#>
 25function Set-KrEnvironment {
 26    [KestrunRuntimeApi('Everywhere')]
 27    [CmdletBinding(SupportsShouldProcess)]
 28    [OutputType([string])]
 29    param(
 30        [Parameter(Mandatory)]
 31        [ValidateSet('Auto', 'Development', 'Staging', 'Production')]
 32        [string]$Name
 33    )
 034    if ($PSCmdlet.ShouldProcess('Kestrun Environment', "Set -> $Name")) {
 035        if ($Name -eq 'Auto') {
 036            [Kestrun.Runtime.EnvironmentHelper]::ClearOverride()
 37        } else {
 038            [Kestrun.Runtime.EnvironmentHelper]::SetOverrideName($Name)
 39        }
 040        [Kestrun.Runtime.EnvironmentHelper]::Name
 41    }
 42}

Methods/Properties

Set-KrEnvironment()