Initial commit of akmon project
This commit is contained in:
24
scripts/load-supabase-env.ps1
Normal file
24
scripts/load-supabase-env.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
param(
|
||||
[string]$EnvPath = "$PSScriptRoot/../.env",
|
||||
[switch]$Persist
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $EnvPath)) {
|
||||
throw "Cannot find .env file at $EnvPath"
|
||||
}
|
||||
|
||||
Get-Content -LiteralPath $EnvPath |
|
||||
Where-Object { $_ -and $_ -notmatch '^\s*#' } |
|
||||
ForEach-Object {
|
||||
$parts = $_ -split '=', 2
|
||||
if ($parts.Length -eq 2) {
|
||||
$key = $parts[0].Trim()
|
||||
$value = $parts[1].Trim()
|
||||
[Environment]::SetEnvironmentVariable($key, $value, 'Process')
|
||||
if ($Persist) {
|
||||
[Environment]::SetEnvironmentVariable($key, $value, 'User')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Loaded environment variables from $EnvPath"
|
||||
Reference in New Issue
Block a user