-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.ps1
49 lines (38 loc) · 1.27 KB
/
setup.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
45
46
47
48
49
Write-Output "Setting up your environment variables."
Write-Output "Press enter to accept the default value shown in brackets."
# Initialize content variable
$envContent = @()
# Read .env.example
$envVars = Get-Content .env.example
foreach ($line in $envVars) {
if ($line -eq "") { continue }
$parts = $line -split "=", 2
$key = $parts[0]
$defaultValue = $parts[1]
# Prompt for value with default
$envInput = Read-Host "$key=($defaultValue)"
if ($envInput -eq "") {
$envInput = $defaultValue
}
# Add to content
$envContent += "$key=$envInput"
}
Write-Output "Creating .env file with your settings..."
# Write to .env file with UTF-8 encoding
$envContent | Out-File -Encoding utf8 .env
# Create cupsd.conf if it doesn't exist
if (-not (Test-Path "cupsd.conf")) {
Write-Output "Creating cupsd.conf file..."
# touch cupsd.conf
New-Item -ItemType file -Name "cupsd.conf"
}
# Create printers.conf if it doesn't exist
if (-not (Test-Path "printers.conf")) {
Write-Output "Creating printers.conf file..."
# touch printers.conf
New-Item -ItemType file -Name "printers.conf"
}
# Run docker compose up
Write-Output "Starting docker compose..."
docker compose up -d
Write-Output "Setup complete! Your project is starting up."