Update MongoDB and PostgreSQL documentation (#993)

* update mongodb and postgresql md

* update pg service
This commit is contained in:
Aleksandr Chebotov
2020-06-03 17:35:03 +03:00
committed by GitHub
parent 1810983a57
commit 52e3e704dd
6 changed files with 82 additions and 70 deletions

View File

@@ -0,0 +1,41 @@
function Get-PostgreSQLMarkdown
{
$name = "PostgreSQL"
$pgService = Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'"
$pgPath = $pgService.PathName
$pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "")
$pgVersion = (pg_config --version).split()[1].Trim()
$content = [PSCustomObject]@{
Version = $pgVersion
UserName = $env:PGUSER
Password = $env:PGPASSWORD
Path = $pgRoot
ServiceName = $pgService.Name
ServiceStatus = $pgService.State
ServiceStartType = $pgService.StartMode
} | New-MDTable
Build-MarkdownElement -Head $name -Content $content
}
function Get-MongoDBMarkdown
{
$name = "MongoDB"
$mongoService = Get-Service -Name $name
$mongoVersion = (Get-Command -Name 'mongo').Version.ToString()
$content = [PSCustomObject]@{
Version = $mongoVersion
ServiceName = $name
ServiceStatus = $mongoService.Status
ServiceStartType = $mongoService.StartType
} | New-MDTable
Build-MarkdownElement -Head $name -Content $content
}
function Build-DatabasesMarkdown
{
$markdown = ""
$markdown += Get-PostgreSQLMarkdown
$markdown += Get-MongoDBMarkdown
$markdown
}