secretsocket: Respect SECRET_SOCKET_PATH
The `secretsocket` server will now create its IPC soket at the location specified by the `SECRET_SOCKET_PATH` environment variable, if set. This way, both `secretsocket` and `xactfetch` can be pointed to the same location with this single variable.master
parent
e4742f1c6e
commit
0f9b3a5ac5
|
@ -15,7 +15,8 @@ log = logging.getLogger('secretsocket')
|
||||||
|
|
||||||
|
|
||||||
ALLOW_UNKNOWN_PEER = os.environ.get('ALLOW_UNKNOWN_PEER') == '1'
|
ALLOW_UNKNOWN_PEER = os.environ.get('ALLOW_UNKNOWN_PEER') == '1'
|
||||||
XDG_RUNTIME_DIR = Path(os.environ['XDG_RUNTIME_DIR'])
|
SECRET_SOCKET_PATH = os.environ.get('SECRET_SOCKET_PATH')
|
||||||
|
XDG_RUNTIME_DIR = os.environ.get('XDG_RUNTIME_DIR')
|
||||||
|
|
||||||
|
|
||||||
class Secret:
|
class Secret:
|
||||||
|
@ -176,7 +177,12 @@ def shutdown(signum, server):
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
sock_path = XDG_RUNTIME_DIR / 'secretsocket/.ss'
|
if SECRET_SOCKET_PATH:
|
||||||
|
sock_path = Path(SECRET_SOCKET_PATH)
|
||||||
|
elif XDG_RUNTIME_DIR:
|
||||||
|
sock_path = Path(XDG_RUNTIME_DIR) / 'secretsocket/.ss'
|
||||||
|
else:
|
||||||
|
sock_path = Path('/tmp/.secretsocket')
|
||||||
|
|
||||||
if not sock_path.parent.exists():
|
if not sock_path.parent.exists():
|
||||||
sock_path.parent.mkdir()
|
sock_path.parent.mkdir()
|
||||||
|
|
Loading…
Reference in New Issue