20 lines
580 B
Bash
Executable File
20 lines
580 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get the directory where this script is located
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
# Get username from secret-mgr
|
|
username=$(secret-mgr get-username --key git)
|
|
if [[ -z "$username" ]]; then
|
|
echo "Error: No username found in secret-mgr for key 'git'"
|
|
exit 1
|
|
fi
|
|
|
|
# Generate new password
|
|
password=$(secret-mgr generate --key git --username "$username")
|
|
|
|
# Update password via gitea admin
|
|
"$SCRIPT_DIR/gitea" admin user change-password --username "$username" --password "$password" --must-change-password=false
|
|
|
|
echo "Password updated for user: $username"
|