-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlogs.ps1
46 lines (31 loc) · 1.34 KB
/
logs.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Param(
[string]$LOG_PATH = ".\logs",
[string]$LOG_PEFIX = "start",
[string]$LOG_SUFFIX = ".log",
[string]$FUNCTIONS_URI = "https://github.com/aem-design/aemdesign-docker/releases/latest/download/functions.ps1",
[string]$SERVICES = "$( (Get-Content ".\start-services.conf" | Where-Object {$_ -notmatch '^#.*'} | Where-Object {-not([String]::IsNullOrWhiteSpace($_))} ) -join " --file ")",
[string]$PORT = "443",
[string]$HOST_URL = "https://localhost",
[Parameter(Position=0)]
[string]$SERVICE_NAME = "" # services to start
)
$SKIP_CONFIG = $true
$PARENT_PROJECT_PATH = "."
. ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "${FUNCTIONS_URI}").Content))))
$PLATFORM=$PSVersionTable.Platform
# get env config
$CONFIG_ENV = (Get-Content ".env" -Raw | ConvertFrom-StringData)
$PORT=$CONFIG_ENV.TRAEFIK_HTTP_PORT
$DOCKER_COMMAND="docker-compose --env-file .env --file docker-compose.yml --file ${SERVICES} logs -f ${SERVICE_NAME}"
if ( [string]::IsNullOrEmpty(${SERVICE_NAME}) ) {
if ( $PLATFORM -eq "Unix" ) {
$OPEN_COMMAND="open"
} else {
$OPEN_COMMAND="explorer"
}
printSubSectionStart "Open Console at $HOST_URL"
Invoke-Expression "${OPEN_COMMAND} ${HOST_URL}"
}
printSubSectionStart "Docker Compose Execute"
printSectionLine "${DOCKER_COMMAND}"
Invoke-Expression "${DOCKER_COMMAND}"