mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 07:01:12 +00:00
set_jwt_private_key (#6774)
* set_jwt_private_key * update set_jwt_private_key
This commit is contained in:
@@ -55,6 +55,27 @@ function check_python_executable() {
|
|||||||
fi
|
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
|
# log function
|
||||||
function log() {
|
function log() {
|
||||||
local time=$(date +"%F %T")
|
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`
|
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`
|
IS_PRO_SEAFEVENTS=`awk '/is_pro/{getline;print $2;exit}' ${pro_pylibs_dir}/seafevents/seafevents_api.py`
|
||||||
|
|
||||||
|
set_jwt_private_key;
|
||||||
|
|
||||||
log "Start Monitor"
|
log "Start Monitor"
|
||||||
|
|
||||||
while [ 1 ]; do
|
while [ 1 ]; do
|
||||||
|
@@ -59,8 +59,22 @@ fi
|
|||||||
|
|
||||||
function set_jwt_private_key () {
|
function set_jwt_private_key () {
|
||||||
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
if [ -z "${JWT_PRIVATE_KEY}" ]; then
|
||||||
jwt_pk=$(python3 parse_jwt_pk.py)
|
if [ ! -e "${central_config_dir}/.env" ]; then
|
||||||
export JWT_PRIVATE_KEY=$jwt_pk
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -186,7 +186,29 @@ function start_seahub () {
|
|||||||
echo
|
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() {
|
function prepare_env() {
|
||||||
|
set_jwt_private_key;
|
||||||
check_python_executable;
|
check_python_executable;
|
||||||
validate_seafile_data_dir;
|
validate_seafile_data_dir;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user