mirror of
https://github.com/koush/scrypted.git
synced 2026-06-11 05:10:30 +01:00
server: add worker ids
This commit is contained in:
2
server/.vscode/launch.json
vendored
2
server/.vscode/launch.json
vendored
@@ -96,7 +96,7 @@
|
||||
"env": {
|
||||
"SCRYPTED_CLUSTER_LABELS": "compute",
|
||||
"SCRYPTED_CLUSTER_MODE": "client",
|
||||
"SCRYPTED_CLUSTER_SERVER": "192.168.2.124",
|
||||
"SCRYPTED_CLUSTER_SERVER": "scrypted-nvr",
|
||||
"SCRYPTED_CLUSTER_SECRET": "swordfish",
|
||||
"SCRYPTED_CAN_RESTART": "true",
|
||||
"SCRYPTED_VOLUME": "/Users/koush/.scrypted-cluster/volume-client",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import os from 'os';
|
||||
import type { ForkOptions } from '@scrypted/types';
|
||||
import { once } from 'events';
|
||||
import net from 'net';
|
||||
@@ -155,7 +156,7 @@ export function startClusterClient(mainFilename: string) {
|
||||
const auth: ClusterObject = {
|
||||
address: socket.localAddress,
|
||||
port: socket.localPort,
|
||||
id: undefined,
|
||||
id: process.env.SCRYPTED_CLUSTER_ID || os.hostname(),
|
||||
proxyId: undefined,
|
||||
sourceKey: undefined,
|
||||
sha256: undefined,
|
||||
@@ -285,6 +286,9 @@ export function createClusterServer(runtime: ScryptedRuntime, certificate: Retur
|
||||
const sha256 = computeClusterObjectHash(auth, runtime.clusterSecret);
|
||||
if (sha256 !== auth.sha256)
|
||||
throw new Error('cluster object hash mismatch');
|
||||
|
||||
peer.peerName = auth.id || `${socket.remoteAddress}`;
|
||||
|
||||
// the remote address may be ipv6 prefixed so use a fuzzy match.
|
||||
// eg ::ffff:192.168.2.124
|
||||
if (!process.env.SCRYPTED_DISABLE_CLUSTER_SERVER_TRUST) {
|
||||
|
||||
Reference in New Issue
Block a user