Improve onboarding verification and routing controls
This commit is contained in:
1 parent
bc0f8e0773
commit
d05de52cd9
30 files changed
+3024
-162
No files matched your search
+26
-10
@@ -16,20 +16,36 @@ if ($isMacOS -or $isLinux) {
|
||||
$env:ENV_FILE = "$PSScriptRoot\env-vars\$env:NODE_ENV.env"
|
||||
}
|
||||
|
||||
# 환경 변수 파일 확인
|
||||
if (-Not (Test-Path $env:ENV_FILE)) {
|
||||
Write-Error "The file '$env:ENV_FILE' does not exist."
|
||||
exit 1
|
||||
}
|
||||
$GLOBAL_ENV_FILE = Join-Path $HOME "source/global-env-vars.txt"
|
||||
|
||||
# 'dahyeon-local.env' 파일에서 환경 변수 설정
|
||||
Get-Content $env:ENV_FILE | ForEach-Object {
|
||||
if ($_ -match '^\s*([^#]+?)\s*=\s*(.*)$') {
|
||||
$key, $value = $matches[1].Trim(), $matches[2].Trim().Trim("`"")
|
||||
[System.Environment]::SetEnvironmentVariable($key, $value)
|
||||
function Import-EnvFileIfPresent {
|
||||
param(
|
||||
[string]$Path,
|
||||
[switch]$Required
|
||||
)
|
||||
|
||||
if (-Not (Test-Path $Path)) {
|
||||
if ($Required) {
|
||||
Write-Error "The file '$Path' does not exist."
|
||||
exit 1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Get-Content $Path | ForEach-Object {
|
||||
if ($_ -match '^\s*([^#]+?)\s*=\s*(.*)$') {
|
||||
$key, $value = $matches[1].Trim(), $matches[2].Trim().Trim("`"")
|
||||
if (-not [System.Environment]::GetEnvironmentVariable($key)) {
|
||||
[System.Environment]::SetEnvironmentVariable($key, $value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 환경 변수 파일 확인
|
||||
Import-EnvFileIfPresent -Path $GLOBAL_ENV_FILE
|
||||
Import-EnvFileIfPresent -Path $env:ENV_FILE -Required
|
||||
|
||||
Get-ChildItem Env: | Where-Object {
|
||||
$_.Name -eq "NODE_ENV" -or
|
||||
$_.Name -like "IMDS_*" -or
|
||||
|
||||
Reference in new issue
Block a user