server: add support for instance uuids
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
0f4276d9b0
commit
02d66a346d
|
@ -17,6 +17,7 @@ import socket
|
|||
import logging
|
||||
import signal
|
||||
import asyncio
|
||||
import uuid
|
||||
from . import confighelper
|
||||
from .eventloop import EventLoop
|
||||
from .app import MoonrakerApp
|
||||
|
@ -509,6 +510,12 @@ def main(from_package: bool = True) -> None:
|
|||
startup_warnings.append(
|
||||
f"Unable to create data path folder at {data_path}"
|
||||
)
|
||||
uuid_path = data_path.joinpath(".moonraker.uuid")
|
||||
if not uuid_path.is_file():
|
||||
instance_uuid = uuid.uuid4().hex
|
||||
uuid_path.write_text(instance_uuid)
|
||||
else:
|
||||
instance_uuid = uuid_path.read_text().strip()
|
||||
if cmd_line_args.configfile is not None:
|
||||
cfg_file: str = cmd_line_args.configfile
|
||||
else:
|
||||
|
@ -522,7 +529,8 @@ def main(from_package: bool = True) -> None:
|
|||
"debug": cmd_line_args.debug,
|
||||
"asyncio_debug": cmd_line_args.asyncio_debug,
|
||||
"is_backup_config": False,
|
||||
"is_python_package": from_package
|
||||
"is_python_package": from_package,
|
||||
"instance_uuid": instance_uuid
|
||||
}
|
||||
|
||||
# Setup Logging
|
||||
|
|
Loading…
Reference in New Issue