Skip to content

Commit 846ecb8

Browse files
committed
Fixing persistence
1 parent 1d42c10 commit 846ecb8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

k8s/base/pyrom-deployment.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ spec:
7575
name: pyrom-config
7676
key: PYROM_LOG_LEVEL
7777
optional: true
78+
# Point to persistent storage directories
79+
- name: PYROM_PLAYER_DIR
80+
value: "/pyrom-persistent/players"
81+
- name: PYROM_WORLD_DIR
82+
value: "/pyrom-persistent/world"
83+
- name: PYROM_SYSTEM_DIR
84+
value: "/pyrom-persistent/system"
7885
ports:
7986
- containerPort: 1337
8087
name: telnet

src/rom24/settings.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@
3838
logger.info("HELP_DIR: %s", HELP_DIR)
3939

4040
# New structure
41+
# Support environment variables for persistent storage in containers
4142
USER_DIR = os.path.expanduser("~")
4243
BASE_DIR = os.path.join(USER_DIR, "rom24")
4344
DATA_DIR = os.path.join(SOURCE_DIR, "data")
44-
WORLD_DIR = os.path.join(DATA_DIR, "world")
45-
PLAYER_DIR = os.path.join(DATA_DIR, "players")
46-
SYSTEM_DIR = os.path.join(DATA_DIR, "system")
45+
46+
# Use environment variables for persistent directories if available
47+
WORLD_DIR = os.environ.get("PYROM_WORLD_DIR", os.path.join(DATA_DIR, "world"))
48+
PLAYER_DIR = os.environ.get("PYROM_PLAYER_DIR", os.path.join(DATA_DIR, "players"))
49+
SYSTEM_DIR = os.environ.get("PYROM_SYSTEM_DIR", os.path.join(DATA_DIR, "system"))
50+
4751
DOC_DIR = os.path.join(DATA_DIR, "docs")
4852
AREA_DIR = LEGACY_AREA_DIR
4953
AREA_LIST_FILE = os.path.join(AREA_DIR, AREA_LIST)

0 commit comments

Comments
 (0)