mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Tweak the config
This commit is contained in:
parent
0932b98a44
commit
fc1bd190ef
2 changed files with 14 additions and 9 deletions
10
app.py
10
app.py
|
@ -51,6 +51,8 @@ from config import PASS
|
|||
from config import HEADERS
|
||||
from config import VERSION
|
||||
from config import DEBUG_MODE
|
||||
from config import JWT
|
||||
from config import ADMIN_API_KEY
|
||||
from config import _drop_db
|
||||
from config import custom_cache_purge_hook
|
||||
from utils.httpsig import HTTPSigAuth, verify_request
|
||||
|
@ -79,14 +81,6 @@ root_logger = logging.getLogger()
|
|||
root_logger.handlers = gunicorn_logger.handlers
|
||||
root_logger.setLevel(gunicorn_logger.level)
|
||||
|
||||
JWT_SECRET = get_secret_key('jwt')
|
||||
JWT = JSONWebSignatureSerializer(JWT_SECRET)
|
||||
|
||||
def _admin_jwt_token() -> str:
|
||||
return JWT.dumps({'me': 'ADMIN', 'ts': datetime.now().timestamp()}).decode('utf-8') # type: ignore
|
||||
|
||||
ADMIN_API_KEY = get_secret_key('admin_api_key', _admin_jwt_token)
|
||||
|
||||
SIG_AUTH = HTTPSigAuth(ID+'#main-key', KEY.privkey)
|
||||
|
||||
|
||||
|
|
13
config.py
13
config.py
|
@ -3,9 +3,10 @@ import os
|
|||
import yaml
|
||||
from pymongo import MongoClient
|
||||
import requests
|
||||
from itsdangerous import JSONWebSignatureSerializer
|
||||
|
||||
from utils import strtobool
|
||||
from utils.key import Key, KEY_DIR
|
||||
from utils.key import Key, KEY_DIR, get_secret_key
|
||||
from utils.actor_service import ActorService
|
||||
from utils.object_service import ObjectService
|
||||
|
||||
|
@ -73,6 +74,16 @@ def _drop_db():
|
|||
|
||||
KEY = Key(USERNAME, DOMAIN, create=True)
|
||||
|
||||
|
||||
JWT_SECRET = get_secret_key('jwt')
|
||||
JWT = JSONWebSignatureSerializer(JWT_SECRET)
|
||||
|
||||
def _admin_jwt_token() -> str:
|
||||
return JWT.dumps({'me': 'ADMIN', 'ts': datetime.now().timestamp()}).decode('utf-8') # type: ignore
|
||||
|
||||
ADMIN_API_KEY = get_secret_key('admin_api_key', _admin_jwt_token)
|
||||
|
||||
|
||||
ME = {
|
||||
"@context": [
|
||||
CTX_AS,
|
||||
|
|
Loading…
Reference in a new issue