Skip to content

perf: seafile_server_url and jwt_private_key can set by env #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions seafile_thumbnail/seahub_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import requests
import logging
import jwt
from seafile_thumbnail.settings import INNER_SEAHUB_SERVICE_URL, JWT_PRIVATE_KEY
from seafile_thumbnail.settings import SEAFILE_SERVER_URL, JWT_PRIVATE_KEY

logger = logging.getLogger(__name__)


def get_jwt_url(repo_id):
jwt_url = '%s/api/v2.1/internal/repos/%s/check-thumbnail/' % (
INNER_SEAHUB_SERVICE_URL.rstrip('/'), repo_id)
SEAFILE_SERVER_URL.rstrip('/'), repo_id)
return jwt_url


Expand Down Expand Up @@ -43,7 +43,7 @@ def jwt_permission_check(session_key, repo_id, path):


def jwt_share_link_permission_check(session_key, token):
jwt_url = '%s/api/v2.1/internal/check-share-link-thumbnail/' % INNER_SEAHUB_SERVICE_URL.rstrip('/')
jwt_url = '%s/api/v2.1/internal/check-share-link-thumbnail/' % SEAFILE_SERVER_URL.rstrip('/')

payload = {
'is_internal': True,
Expand Down
5 changes: 3 additions & 2 deletions seafile_thumbnail/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# url
URL_PREFIX = '/'
INNER_SEAHUB_SERVICE_URL = 'http://127.0.0.1:8000'
SEAFILE_SERVER_URL = 'http://127.0.0.1:8000'

# dir
CONF_DIR = '/data/conf/'
Expand Down Expand Up @@ -67,4 +67,5 @@
except ImportError as e:
pass


SEAFILE_SERVER_URL = os.getenv('SEAFILE_SERVER_URL') or SEAFILE_SERVER_URL
JWT_PRIVATE_KEY = os.getenv('JWT_PRIVATE_KEY') or JWT_PRIVATE_KEY