@justin0713/opspilot 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/bin/opspilot.js +19 -18
- package/package.json +1 -1
package/bin/opspilot.js
CHANGED
|
@@ -100,22 +100,19 @@ function cmdStart(flags) {
|
|
|
100
100
|
checkDocker();
|
|
101
101
|
|
|
102
102
|
const cfg = loadConfig();
|
|
103
|
-
const token = flags.token
|
|
104
|
-
const url = flags['cloud-url'] || cfg.cloudUrl || '
|
|
105
|
-
const port = flags.port
|
|
106
|
-
const data = flags['data-dir']
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
);
|
|
103
|
+
const token = flags.token || cfg.token || '';
|
|
104
|
+
const url = flags['cloud-url'] || cfg.cloudUrl || '';
|
|
105
|
+
const port = flags.port || cfg.port || '5000';
|
|
106
|
+
const data = flags['data-dir'] || cfg.dataDir || 'opspilot-data';
|
|
107
|
+
|
|
108
|
+
// Token is optional — without it OpsPilot runs in standalone mode
|
|
109
|
+
if (token) {
|
|
110
|
+
saveConfig({ token, cloudUrl: url || 'https://teams.codetop.net', port, dataDir: data });
|
|
111
|
+
} else {
|
|
112
|
+
warn('No --token provided — starting in standalone mode (no license validation).');
|
|
113
|
+
saveConfig({ port, dataDir: data });
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
// Persist for next run
|
|
117
|
-
saveConfig({ token, cloudUrl: url, port, dataDir: data });
|
|
118
|
-
|
|
119
116
|
// Stop existing container if running
|
|
120
117
|
const existing = tryRun(`docker inspect -f "{{.State.Status}}" ${CONTAINER} 2>/dev/null`);
|
|
121
118
|
if (existing === 'running') {
|
|
@@ -132,15 +129,19 @@ function cmdStart(flags) {
|
|
|
132
129
|
|
|
133
130
|
// Volume arg: named volume or host path
|
|
134
131
|
const isAbsolute = path.isAbsolute(data);
|
|
135
|
-
const volArg =
|
|
132
|
+
const volArg = `${data}:/app/data`;
|
|
133
|
+
|
|
134
|
+
// Build docker run args — only pass cloud env vars if token is set
|
|
135
|
+
const cloudEnv = token
|
|
136
|
+
? `-e OPSPILOT_CLOUD_URL=${url || 'https://teams.codetop.net'} -e OPSPILOT_CLOUD_TOKEN=${token} `
|
|
137
|
+
: '';
|
|
136
138
|
|
|
137
139
|
log(`Starting OpsPilot Local on port ${port} ...`);
|
|
138
140
|
run(
|
|
139
141
|
`docker run -d ` +
|
|
140
142
|
`--name ${CONTAINER} ` +
|
|
141
143
|
`-p ${port}:5000 ` +
|
|
142
|
-
|
|
143
|
-
`-e OPSPILOT_CLOUD_TOKEN=${token} ` +
|
|
144
|
+
cloudEnv +
|
|
144
145
|
`-e OPSPILOT_PORT=5000 ` +
|
|
145
146
|
`-v ${volArg} ` +
|
|
146
147
|
`--restart unless-stopped ` +
|
|
@@ -232,7 +233,7 @@ ${BOLD}Commands:${RESET}
|
|
|
232
233
|
${CYAN}config${RESET} Show saved local config
|
|
233
234
|
|
|
234
235
|
${BOLD}Start options:${RESET}
|
|
235
|
-
--token <token> License token from OpsPilot Cloud ${YELLOW}(
|
|
236
|
+
--token <token> License token from OpsPilot Cloud ${YELLOW}(optional — omit to run standalone)${RESET}
|
|
236
237
|
--cloud-url <url> Cloud server URL [default: https://teams.codetop.net]
|
|
237
238
|
--port <port> Local port [default: 5000]
|
|
238
239
|
--data-dir <path> Host data path or Docker volume name [default: opspilot-data]
|
package/package.json
CHANGED