forked from ParisNeo/ollama_proxy_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.sh
More file actions
83 lines (67 loc) · 2.55 KB
/
reset.sh
File metadata and controls
83 lines (67 loc) · 2.55 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# ====================================================================
#
# Ollama Proxy Fortress - FULL RESET SCRIPT
# For: macOS & Linux
#
# ====================================================================
# --- Colors for the warning message ---
COLOR_RESET='\e[0m'
COLOR_ERROR='\e[1;31m' # Bold Red
COLOR_WARN='\e[1;33m' # Bold Yellow
clear
# --- Display the Irreversible Action Warning ---
echo -e "${COLOR_ERROR}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo -e "${COLOR_ERROR}!! W A R N I N G !!"
echo -e "${COLOR_ERROR}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${COLOR_RESET}"
echo
echo -e "${COLOR_WARN}This script will completely reset the application.${COLOR_RESET}"
echo "The following actions will be performed:"
echo
echo " - The Python virtual environment ('venv') will be deleted."
echo " - The configuration file ('.env') will be deleted."
echo " - The setup state file ('.setup_state') will be deleted."
echo " - The database ('ollama_proxy.db') will be deleted."
echo " - All generated Python cache files ('__pycache__') will be removed."
echo
echo -e "${COLOR_ERROR}This operation is IRREVERSIBLE and all your users, API keys,"
echo -e "and settings will be permanently lost.${COLOR_RESET}"
echo
# --- Require User Confirmation ---
read -p "To confirm you want to proceed, please type 'reset now': " CONFIRMATION
if [[ "$CONFIRMATION" != "reset now" ]]; then
echo
echo "Confirmation not received. Reset has been cancelled."
exit 1
fi
echo
echo "Confirmation received. Proceeding with the reset..."
echo
# --- Perform Deletion Actions ---
echo "1. Deleting Python virtual environment ('venv')..."
rm -rf venv
echo " - Done."
echo "2. Deleting configuration file ('.env')..."
rm -f .env
echo " - Done."
echo "3. Deleting setup state file ('.setup_state')..."
rm -f .setup_state
echo " - Done."
echo "4. Deleting database file ('ollama_proxy.db')..."
rm -f ollama_proxy.db ollama_proxy.db-journal
echo " - Done."
echo "5. Deleting Alembic versions (optional, for clean migration history)..."
# In case of corrupted migrations, this is a good idea.
# We recreate the directory so alembic doesn't fail.
if [ -d "alembic/versions" ]; then
rm -rf alembic/versions/*
touch alembic/versions/.gitkeep
fi
echo " - Done."
echo "6. Cleaning up Python cache files..."
find . -type d -name "__pycache__" -exec rm -r {} +
echo " - Done."
echo
echo -e "${COLOR_SUCCESS}Reset complete.${COLOR_RESET}"
echo "You can now run 'run.sh' to start a fresh installation."
echo