Skip to content

Commit

Permalink
feat/identity (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Sep 14, 2023
1 parent e3c69bb commit ec63939
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions hivemind_voice_satellite/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,33 @@
from ovos_utils import wait_for_exit_signal
from ovos_utils.log import init_service_logger, LOG
from hivemind_voice_satellite import VoiceClient
from hivemind_bus_client.identity import NodeIdentity


@click.command(help="connect to HiveMind")
@click.option("--host", help="hivemind host", type=str, default="wss://127.0.0.1")
@click.option("--key", help="Access Key", type=str)
@click.option("--password", help="Password for key derivation", type=str)
@click.option("--host", help="hivemind host", type=str, default="")
@click.option("--key", help="Access Key", type=str, default="")
@click.option("--password", help="Password for key derivation", type=str, default="")
@click.option("--port", help="HiveMind port number", type=int, default=5678)
@click.option("--selfsigned", help="accept self signed certificates", is_flag=True)
@click.option("--siteid", help="location identifier for message.context", type=str, default="unknown")
@click.option("--siteid", help="location identifier for message.context", type=str, default="")
def connect(host, key, password, port, selfsigned, siteid):

init_service_logger("HiveMind-voice-sat")


identity = NodeIdentity()
password = password or identity.password
key = key or identity.access_key
siteid = siteid or identity.site_id or "unknown"
host = host or identity.default_master

if not host.startswith("ws://") and not host.startswith("wss://"):
host = "ws://" + host

if not key or not password or not host:
raise RuntimeError("NodeIdentity not set, please pass key/password/host or "
"call 'hivemind-client set-identity'")

if not host.startswith("ws"):
LOG.error("Invalid host, please specify a protocol")
LOG.error(f"ws://{host} or wss://{host}")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hivemind_bus_client>=0.0.4a8
hivemind_bus_client>=0.0.4a10
ovos-audio
ovos-dinkum-listener>=0.0.2, < 0.1.0
ovos-vad-plugin-webrtcvad
Expand Down

0 comments on commit ec63939

Please sign in to comment.