hsync 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js CHANGED
@@ -12,22 +12,32 @@ program
12
12
  .addOption(new Option('-p, --port <number>', 'port for local webserver', 3000).env('PORT'))
13
13
  .addOption(new Option('-d, --dynamic-host <url>', 'host to get a dynamic connection from').env('HSYNC_DYNAMIC_HOST'))
14
14
  .addOption(new Option('-s, --hsync-server <url>', 'hsync-server location ex: wss://sub.mydomain.com').env('HSYNC_SERVER'))
15
- .addOption(new Option('-p, --hsync-password <url>', 'password to connect to hsync-server').env('HSYNC_SECRET'));
15
+ .addOption(new Option('-hs, --hsync-secret <url>', 'password to connect to hsync-server').env('HSYNC_SECRET'));
16
16
 
17
17
  program.parse();
18
18
 
19
19
  const options = program.opts();
20
20
 
21
- console.log(options);
22
21
 
23
- const [defaultCon] = config.connections;
22
+ if(options.port) {
23
+ options.port = Number(options.port);
24
+ }
25
+
26
+ let [defaultCon] = config.connections;
27
+ defaultCon = {...defaultCon, ...options};
28
+
24
29
  if (!defaultCon.hsyncServer && !defaultCon.dynamicHost) {
25
30
  defaultCon.dynamicHost = config.defaultDynamicHost;
26
31
  }
27
32
 
33
+ config.connections[0] = defaultCon;
34
+
28
35
  config.connections.forEach(async (conConfig) => {
29
36
  const con = await createConnection(conConfig);
37
+ console.log();
30
38
  console.log('Listening for requests on: ', con.webUrl);
39
+ console.log('And forwarding to: ', 'http://localhost:' + con.port);
40
+ console.log();
41
+ console.log('Admin ui at: ', con.webAdmin);
31
42
  console.log('Secret: ', con.hsyncSecret);
32
- console.log('Admin instance at: ', con.webAdmin);
33
43
  });
package/connection.js CHANGED
@@ -227,6 +227,7 @@ async function createHsync(config) {
227
227
  hsyncClient.webUrl = `https://${myHostName}`;
228
228
  }
229
229
  hsyncClient.webAdmin = `${hsyncClient.webUrl}/${hsyncBase}/admin`;
230
+ hsyncClient.port = port;
230
231
 
231
232
  return hsyncClient;
232
233
  }