@@ -0,0 +1,35 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$envFile = Join-Path $PSScriptRoot ".env"
|
||||
|
||||
if (-not (Test-Path $envFile)) {
|
||||
throw "Keine .env-Datei gefunden: $envFile"
|
||||
}
|
||||
|
||||
Get-Content $envFile | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
|
||||
if ($line -and -not $line.StartsWith("#")) {
|
||||
$parts = $line -split "=", 2
|
||||
|
||||
if ($parts.Count -eq 2) {
|
||||
$name = $parts[0].Trim()
|
||||
$value = $parts[1].Trim()
|
||||
|
||||
if (
|
||||
($value.StartsWith('"') -and $value.EndsWith('"')) -or
|
||||
($value.StartsWith("'") -and $value.EndsWith("'"))
|
||||
) {
|
||||
$value = $value.Substring(1, $value.Length - 2)
|
||||
}
|
||||
|
||||
[Environment]::SetEnvironmentVariable(
|
||||
$name,
|
||||
$value,
|
||||
"Process"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
go run .\cmd\agent
|
||||
Reference in New Issue
Block a user