feat: implement modern admin studio with live AD, NetApp, MS SQL connectivity and comprehensive docs
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Modules\ConfigService.ps1
|
||||
# Configuration Management Module for Enterprise Admin Studio
|
||||
|
||||
$global:AppConfigPath = Join-Path (Split-Path -Parent $PSScriptRoot) "config.json"
|
||||
|
||||
function Get-AppConfig {
|
||||
if (-not (Test-Path $global:AppConfigPath)) {
|
||||
$defaultConfig = @{
|
||||
Application = @{
|
||||
LiveMode = $false
|
||||
Theme = "Dark"
|
||||
AutoRefreshSeconds = 60
|
||||
}
|
||||
ActiveDirectory = @{
|
||||
UseLive = $false
|
||||
DomainController = "dc01.corp.local"
|
||||
Domain = "corp.local"
|
||||
BaseOU = "DC=corp,DC=local"
|
||||
UseLdaps = $false
|
||||
Username = ""
|
||||
Password = ""
|
||||
}
|
||||
NetApp = @{
|
||||
UseLive = $false
|
||||
ClusterEndpoint = "https://10.200.10.50"
|
||||
Port = 443
|
||||
DefaultSvm = "svm_cifs_prod01"
|
||||
Username = "admin"
|
||||
Password = ""
|
||||
IgnoreSslErrors = $true
|
||||
}
|
||||
MsSql = @{
|
||||
UseLive = $false
|
||||
Server = "localhost"
|
||||
AuthType = "Integrated"
|
||||
Username = "sa"
|
||||
Password = ""
|
||||
DefaultDatabase = "master"
|
||||
ConnectionTimeout = 10
|
||||
BackupDirectory = "C:\Backups"
|
||||
}
|
||||
}
|
||||
$json = $defaultConfig | ConvertTo-Json -Depth 5
|
||||
[System.IO.File]::WriteAllText($global:AppConfigPath, $json, [System.Text.Encoding]::UTF8)
|
||||
return $defaultConfig
|
||||
}
|
||||
|
||||
try {
|
||||
$raw = [System.IO.File]::ReadAllText($global:AppConfigPath, [System.Text.Encoding]::UTF8)
|
||||
return ($raw | ConvertFrom-Json)
|
||||
} catch {
|
||||
Write-Warning "설정 파일 로드 실패, 기본값을 사용합니다: $_"
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
function Save-AppConfig {
|
||||
param([object]$Config)
|
||||
|
||||
try {
|
||||
$json = $Config | ConvertTo-Json -Depth 5
|
||||
[System.IO.File]::WriteAllText($global:AppConfigPath, $json, [System.Text.Encoding]::UTF8)
|
||||
return $true
|
||||
} catch {
|
||||
Write-Error "설정 저장 실패: $_"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user