docker: fix data persistence with TINYWEB_DATA_DIR env var
This commit is contained in:
parent
8214f241fa
commit
1d40f996ab
4 changed files with 4 additions and 5 deletions
|
|
@ -13,9 +13,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p /data \
|
||||
&& ln -sf /data/index.db index.db \
|
||||
&& ln -sf /data/tinyweb_identity tinyweb_identity
|
||||
RUN mkdir -p /data
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
|
|
|
|||
2
app.py
2
app.py
|
|
@ -16,7 +16,7 @@ from gateway import GatewayState, GatewayHandler
|
|||
IDENTITY_FILE = "tinyweb_identity"
|
||||
DEFAULT_TRANSPORT_HOST = "rnode.bre.land"
|
||||
DEFAULT_TRANSPORT_PORT = 4242
|
||||
DATA_DIR = os.path.expanduser("~/.tinyweb")
|
||||
DATA_DIR = os.environ.get("TINYWEB_DATA_DIR") or os.path.expanduser("~/.tinyweb")
|
||||
|
||||
|
||||
def get_transport_config():
|
||||
|
|
|
|||
2
db.py
2
db.py
|
|
@ -6,7 +6,7 @@ import os
|
|||
from urllib.parse import urlparse, urljoin, parse_qs, urlencode, urlunparse, quote
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
DATA_DIR = os.path.expanduser("~/.tinyweb")
|
||||
DATA_DIR = os.environ.get("TINYWEB_DATA_DIR") or os.path.expanduser("~/.tinyweb")
|
||||
DATABASE = os.path.join(DATA_DIR, "index.db")
|
||||
|
||||
BLOCKED_NETWORKS = [
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ if [ ! -f "$CONFIG_FILE" ]; then
|
|||
EOF
|
||||
fi
|
||||
|
||||
export TINYWEB_DATA_DIR="/data"
|
||||
export RNS_CONFIG_DIR="$CONFIG_DIR"
|
||||
# Bind to 0.0.0.0 inside the container; isolation is handled by Docker's port mapping.
|
||||
exec python app.py --bind 0.0.0.0 "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue