Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

Commit

Permalink
chore: Add loading of external device files, and user config stub
Browse files Browse the repository at this point in the history
Allow loading from device files passed in as arguments. Loading of
user device files is stubbed, but still need to be implemented in
buttplug-js.
  • Loading branch information
qdot committed Apr 20, 2019
1 parent 9434725 commit bb1e42d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/ButtplugServerCLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as selfsigned from "selfsigned";
import * as fs from "fs";
import * as path from "path";
import { IntifaceGuiProtocol } from "./intiface-gui-proto";
import { ButtplugLogger, ButtplugLogLevel } from "buttplug";
import { ButtplugLogger, ButtplugLogLevel, DeviceConfigurationManager } from "buttplug";
import { ButtplugNodeBluetoothLEDeviceManager } from "buttplug-node-bluetoothle-manager";
import { ButtplugNodeWebsocketServer } from "buttplug-node-websockets";

Expand Down Expand Up @@ -48,6 +48,25 @@ export class ButtplugServerCLI {
return;
}

// If we are passed a device configuration file, use that. Otherwise, use
// the one built into the library.
if (commander.deviceconfig) {
DeviceConfigurationManager.LoadFromExternalConfig(commander.deviceconfig);
} else {
DeviceConfigurationManager.LoadFromInternalConfig();
}

// Load an outside Configuration
//
// TODO Not yet implemented in Buttplug
//
// if (commander.userdeviceconfig) {
// DeviceConfigurationManager.Manager.LoadUserConfiguration(commander.userdeviceconfig);
// }
if (commander.userdeviceconfig) {
throw new Error("User device configuration not currently implemented in this engine.");
}

if (!commander.wsinsecureport && !commander.wssecureport && !commander.ipcserver) {
console.log("Must specify either Websocket secure or insecure port, or IPC server.");
return;
Expand Down

0 comments on commit bb1e42d

Please sign in to comment.