Initialize Nele & Till Wedding Gallery
This commit is contained in:
commit
a1c808cc6b
59 files changed
+13518
No files matched your search
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Decrypts .env.age to .env using the local age private key
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$ProjectRoot = Split-Path -Parent $ScriptDir
|
||||
$EnvFile = Join-Path $ProjectRoot '.env'
|
||||
$EnvAgeFile = Join-Path $ProjectRoot '.env.age'
|
||||
|
||||
# Try common key locations
|
||||
$KeyLocations = @(
|
||||
(Join-Path $env:USERPROFILE '.age' 'keys.txt'),
|
||||
(Join-Path $ProjectRoot 'keys' 'age-key.txt'),
|
||||
'/opt/Jannik-Cloud/keys/age-key.txt'
|
||||
)
|
||||
|
||||
$KeyFile = $null
|
||||
foreach ($loc in $KeyLocations) {
|
||||
if (Test-Path $loc) {
|
||||
$KeyFile = $loc
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $KeyFile) {
|
||||
Write-Error "No age private key found. Searched: $($KeyLocations -join ', ')"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (-not (Test-Path $EnvAgeFile)) {
|
||||
Write-Error ".env.age file not found at $EnvAgeFile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Decrypting .env.age -> .env using key $KeyFile ..." -ForegroundColor Green
|
||||
age --decrypt -i $KeyFile -o $EnvFile $EnvAgeFile
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Done. .env restored successfully." -ForegroundColor Green
|
||||
} else {
|
||||
Write-Error "Decryption failed!"
|
||||
exit 1
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Decrypts .env.age to .env using the local age private key
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
ENV_FILE="${PROJECT_ROOT}/.env"
|
||||
ENV_AGE_FILE="${PROJECT_ROOT}/.env.age"
|
||||
|
||||
# Try common key locations
|
||||
KEY_FILE=""
|
||||
for loc in "${HOME}/.age/keys.txt" "${PROJECT_ROOT}/keys/age-key.txt" "/opt/Jannik-Cloud/keys/age-key.txt"; do
|
||||
if [[ -f "$loc" ]]; then
|
||||
KEY_FILE="$loc"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$KEY_FILE" ]]; then
|
||||
echo "ERROR: No age private key found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$ENV_AGE_FILE" ]]; then
|
||||
echo "ERROR: .env.age not found at $ENV_AGE_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Decrypting .env.age -> .env using key $KEY_FILE ..."
|
||||
age --decrypt -i "$KEY_FILE" -o "$ENV_FILE" "$ENV_AGE_FILE"
|
||||
chmod 600 "$ENV_FILE"
|
||||
echo "Done. .env restored successfully."
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Encrypts .env to .env.age using the Jannik-Cloud age public key
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$ProjectRoot = Split-Path -Parent $ScriptDir
|
||||
$EnvFile = Join-Path $ProjectRoot '.env'
|
||||
$EnvAgeFile = Join-Path $ProjectRoot '.env.age'
|
||||
$PublicKey = 'age1sa3q5qxl5dylld7v839m9lkv5h7l457wq4h40pt7kfmcfhcqkfjqspdjpn'
|
||||
|
||||
if (-not (Test-Path $EnvFile)) {
|
||||
Write-Error ".env file not found at $EnvFile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Encrypting .env -> .env.age ..." -ForegroundColor Green
|
||||
age --encrypt -r $PublicKey -o $EnvAgeFile $EnvFile
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Done. .env.age created successfully." -ForegroundColor Green
|
||||
Write-Host "You can now safely commit .env.age to git." -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Error "Encryption failed!"
|
||||
exit 1
|
||||
}
|
||||
Reference in new issue
Block a user