mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Add automatic backup of previous configuration
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
try {
|
||||
# Create config file with API settings
|
||||
$configPath = "$env:USERPROFILE\.wakatime.cfg"
|
||||
|
||||
# If config exists, backup
|
||||
if (Test-Path $configPath) {
|
||||
Write-Host "[INFO] Config file already exists, moving into ~/.wakatime.cfg.bak"
|
||||
Move-Item -Path $configPath -Destination "$configPath.bak"
|
||||
}
|
||||
|
||||
@"
|
||||
[settings]
|
||||
api_url = $env:HACKATIME_API_URL
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# If config exists, backup
|
||||
if [ -f ~/.wakatime.cfg ]; then
|
||||
echo "[INFO] Config file already exists, moving into ~/.wakatime.cfg.bak"
|
||||
mv ~/.wakatime.cfg ~/.wakatime.cfg.bak
|
||||
fi
|
||||
|
||||
# Create or update config file
|
||||
cat > ~/.wakatime.cfg << EOL
|
||||
[settings]
|
||||
@@ -46,4 +52,4 @@ if [ "$http_code" = "200" ] || [ "$http_code" = "202" ]; then
|
||||
else
|
||||
echo -e "\nError sending heartbeat: $body"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user