1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

set_jwt_private_key (#6774)

* set_jwt_private_key

* update set_jwt_private_key
This commit is contained in:
欢乐马 2024-09-14 17:01:17 +08:00 committed by GitHub
parent 69bf11127b
commit 1345fc0254
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 61 additions and 2 deletions

View File

@ -55,6 +55,27 @@ function check_python_executable() {
fi
}
function set_jwt_private_key () {
if [ -z "${JWT_PRIVATE_KEY}" ]; then
if [ ! -e "${central_config_dir}/.env" ]; then
echo "Error: .env file not found."
echo "Please follow the upgrade manual to set the .env file."
echo ""
exit -1;
fi
# load the .env file
source "${central_config_dir}/.env"
if [ -z "${JWT_PRIVATE_KEY}" ]; then
echo "Error: JWT_PRIVATE_KEY not found in .env file."
echo "Please follow the upgrade manual to set the .env file."
echo ""
exit -1;
fi
fi
}
# log function
function log() {
local time=$(date +"%F %T")
@ -108,6 +129,8 @@ function monitor_seafevents() {
ENABLE_NOTIFICATION_SERVER=`awk -F '=' '/\[notification\]/{a=1}a==1&&$1~/^enabled/{print $2;exit}' ${central_config_dir}/seafile.conf`
IS_PRO_SEAFEVENTS=`awk '/is_pro/{getline;print $2;exit}' ${pro_pylibs_dir}/seafevents/seafevents_api.py`
set_jwt_private_key;
log "Start Monitor"
while [ 1 ]; do

View File

@ -59,8 +59,22 @@ fi
function set_jwt_private_key () {
if [ -z "${JWT_PRIVATE_KEY}" ]; then
jwt_pk=$(python3 parse_jwt_pk.py)
export JWT_PRIVATE_KEY=$jwt_pk
if [ ! -e "${central_config_dir}/.env" ]; then
echo "Error: .env file not found."
echo "Please follow the upgrade manual to set the .env file."
echo ""
exit -1;
fi
# load the .env file
source "${central_config_dir}/.env"
if [ -z "${JWT_PRIVATE_KEY}" ]; then
echo "Error: JWT_PRIVATE_KEY not found in .env file."
echo "Please follow the upgrade manual to set the .env file."
echo ""
exit -1;
fi
fi
}

View File

@ -186,7 +186,29 @@ function start_seahub () {
echo
}
function set_jwt_private_key () {
if [ -z "${JWT_PRIVATE_KEY}" ]; then
if [ ! -e "${central_config_dir}/.env" ]; then
echo "Error: .env file not found."
echo "Please follow the upgrade manual to set the .env file."
echo ""
exit -1;
fi
# load the .env file
source "${central_config_dir}/.env"
if [ -z "${JWT_PRIVATE_KEY}" ]; then
echo "Error: JWT_PRIVATE_KEY not found in .env file."
echo "Please follow the upgrade manual to set the .env file."
echo ""
exit -1;
fi
fi
}
function prepare_env() {
set_jwt_private_key;
check_python_executable;
validate_seafile_data_dir;