Fix confdir passing to workers
This commit is contained in:
parent
37e06dd412
commit
d2ad269df8
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -117,6 +118,7 @@ def _confdir(args):
|
||||||
raise ValueError("Config path is not a directory")
|
raise ValueError("Config path is not a directory")
|
||||||
# Accidentally pointed to the db.toml, use parent
|
# Accidentally pointed to the db.toml, use parent
|
||||||
confdir = confdir.parent
|
confdir = confdir.parent
|
||||||
|
os.environ["CISTA_HOME"] = confdir.as_posix()
|
||||||
config.conffile = confdir / config.conffile.name
|
config.conffile = confdir / config.conffile.name
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ app.exception(Exception)(handle_sanic_exception)
|
||||||
async def main_start(app, loop):
|
async def main_start(app, loop):
|
||||||
tracemalloc.start()
|
tracemalloc.start()
|
||||||
config.load_config()
|
config.load_config()
|
||||||
print(config.config, config.config.public)
|
|
||||||
app.ctx.threadexec = ThreadPoolExecutor(
|
app.ctx.threadexec = ThreadPoolExecutor(
|
||||||
max_workers=3, thread_name_prefix="cista-ioworker"
|
max_workers=3, thread_name_prefix="cista-ioworker"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
import sys
|
import sys
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
@ -33,7 +34,7 @@ class Link(msgspec.Struct, omit_defaults=True):
|
||||||
|
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
conffile = Path.home() / ".local/share/cista/db.toml"
|
conffile = os.environ.get("CISTA_HOME") or Path.home() / ".local/share/cista/db.toml"
|
||||||
|
|
||||||
|
|
||||||
def derived_secret(*params, len=8) -> bytes:
|
def derived_secret(*params, len=8) -> bytes:
|
||||||
|
|
|
@ -5,7 +5,6 @@ import msgspec
|
||||||
|
|
||||||
def readconf() -> dict:
|
def readconf() -> dict:
|
||||||
p = Path.home() / ".droppy/config" # Hardcoded in Droppy
|
p = Path.home() / ".droppy/config" # Hardcoded in Droppy
|
||||||
print("Reading Droppy config", p)
|
|
||||||
cf = msgspec.json.decode((p / "config.json").read_bytes())
|
cf = msgspec.json.decode((p / "config.json").read_bytes())
|
||||||
db = msgspec.json.decode((p / "db.json").read_bytes())
|
db = msgspec.json.decode((p / "db.json").read_bytes())
|
||||||
cf["path"] = p.parent / "files"
|
cf["path"] = p.parent / "files"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user