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:
parent
69bf11127b
commit
1345fc0254
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user