1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 11:01:14 +00:00

Add check and set JWT_PRIVATE_KEY env (#6675)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks 2024-09-03 18:44:39 +08:00 committed by GitHub
parent 697aaf3c41
commit 7a09ebd288
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

3
scripts/parse_jwt_pk.py Normal file
View File

@ -0,0 +1,3 @@
import seahub_settings
print(seahub_settings.JWT_PRIVATE_KEY)

View File

@ -51,12 +51,19 @@ function validate_running_user () {
fi
}
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3/site-packages:${INSTALLPATH}/seafile/lib64/python3/site-packages:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3/site-packages:${INSTALLPATH}/seafile/lib64/python3/site-packages:${INSTALLPATH}/seahub/thirdpart:${central_config_dir}:$PYTHONPATH
if [[ -d ${INSTALLPATH}/pro ]]; then
export PYTHONPATH=$PYTHONPATH:$pro_pylibs_dir
export SEAFES_DIR=$seafesdir
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
fi
}
function validate_central_conf_dir () {
if [[ ! -d ${central_config_dir} ]]; then
echo "Error: there is no conf/ directory."
@ -109,6 +116,7 @@ function validate_already_running () {
}
function start_seafile_server () {
set_jwt_private_key;
validate_already_running;
validate_central_conf_dir;
validate_seafile_data_dir;