synqdb-agent 1.0.1 → 1.0.2
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/index.js +4 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -32,10 +32,10 @@ const saved = loadConfig();
|
|
|
32
32
|
|
|
33
33
|
// --save flag: persist key (and optional server URL) then exit
|
|
34
34
|
if (process.argv.includes('--save')) {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const keyToSave =
|
|
38
|
-
const urlToSave =
|
|
35
|
+
const saveIdx = process.argv.indexOf('--save');
|
|
36
|
+
const nonFlagArgs = process.argv.slice(saveIdx + 1).filter((a) => !a.startsWith('-'));
|
|
37
|
+
const keyToSave = nonFlagArgs[0] || process.env.SYNQDB_AGENT_KEY;
|
|
38
|
+
const urlToSave = nonFlagArgs[1] || process.env.SYNQDB_SERVER_URL;
|
|
39
39
|
|
|
40
40
|
if (!keyToSave) {
|
|
41
41
|
console.error('Usage: synqdb-agent --save <agentKey> [serverUrl]');
|