[macOS] Add apache and nginx (#2522)

* add apache and nginx

* swap config and service status

* add new line

* remove notes
This commit is contained in:
Aleksandr Chebotov
2021-01-26 17:14:31 +03:00
committed by GitHub
parent ed5d4dc5c5
commit 5537d89215
7 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
function Get-ApacheVersion {
$name = "httpd"
$port = 80
$version = brew list $name --versions | Take-Part -Part 1
$serviceStatus = (brew services list) -match $name | Take-Part -Part 1
$configFile = "$(brew --prefix)/etc/httpd/httpd.conf"
return [PsCustomObject]@{
"Name" = $name
"Version" = $version
"ConfigFile" = $configFile
"ServiceStatus" = $serviceStatus
"ListenPort" = $port
}
}
function Get-NginxVersion {
$name = "nginx"
$port = 80
$version = brew list $name --versions | Take-Part -Part 1
$serviceStatus = (brew services list) -match $name | Take-Part -Part 1
$configFile = "$(brew --prefix)/etc/nginx/nginx.conf"
return [PsCustomObject]@{
"Name" = $name
"Version" = $version
"ConfigFile" = $configFile
"ServiceStatus" = $serviceStatus
"ListenPort" = $port
}
}
function Build-WebServersSection {
$output = ""
$output += New-MDHeader "Web Servers" -Level 3
$output += @(
(Get-ApacheVersion),
(Get-NginxVersion)
) | Sort-Object Name | New-MDTable
$output += New-MDNewLine
return $output
}