@justin0713/opspilot 1.0.2 → 1.0.3
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 +12 -13
- package/package.json +1 -1
package/bin/opspilot.js
CHANGED
|
@@ -105,14 +105,17 @@ function cmdStart(flags) {
|
|
|
105
105
|
const port = flags.port || cfg.port || '5000';
|
|
106
106
|
const data = flags['data-dir'] || cfg.dataDir || 'opspilot-data';
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
if (!token) {
|
|
109
|
+
die(
|
|
110
|
+
'License token is required.\n' +
|
|
111
|
+
' opspilot start --token <your-license-token>\n' +
|
|
112
|
+
' Get a token: log in to OpsPilot Cloud → Dashboard → License Tokens → Generate'
|
|
113
|
+
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
// Persist for next run
|
|
117
|
+
saveConfig({ token, cloudUrl: url || 'https://teams.codetop.net', port, dataDir: data });
|
|
118
|
+
|
|
116
119
|
// Stop existing container if running
|
|
117
120
|
const existing = tryRun(`docker inspect -f "{{.State.Status}}" ${CONTAINER} 2>/dev/null`);
|
|
118
121
|
if (existing === 'running') {
|
|
@@ -131,17 +134,13 @@ function cmdStart(flags) {
|
|
|
131
134
|
const isAbsolute = path.isAbsolute(data);
|
|
132
135
|
const volArg = `${data}:/app/data`;
|
|
133
136
|
|
|
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
|
-
: '';
|
|
138
|
-
|
|
139
137
|
log(`Starting OpsPilot Local on port ${port} ...`);
|
|
140
138
|
run(
|
|
141
139
|
`docker run -d ` +
|
|
142
140
|
`--name ${CONTAINER} ` +
|
|
143
141
|
`-p ${port}:5000 ` +
|
|
144
|
-
|
|
142
|
+
`-e OPSPILOT_CLOUD_URL=${url || 'https://teams.codetop.net'} ` +
|
|
143
|
+
`-e OPSPILOT_CLOUD_TOKEN=${token} ` +
|
|
145
144
|
`-e OPSPILOT_PORT=5000 ` +
|
|
146
145
|
`-v ${volArg} ` +
|
|
147
146
|
`--restart unless-stopped ` +
|
|
@@ -233,7 +232,7 @@ ${BOLD}Commands:${RESET}
|
|
|
233
232
|
${CYAN}config${RESET} Show saved local config
|
|
234
233
|
|
|
235
234
|
${BOLD}Start options:${RESET}
|
|
236
|
-
--token <token> License token from OpsPilot Cloud ${YELLOW}(
|
|
235
|
+
--token <token> License token from OpsPilot Cloud ${YELLOW}(required)${RESET}
|
|
237
236
|
--cloud-url <url> Cloud server URL [default: https://teams.codetop.net]
|
|
238
237
|
--port <port> Local port [default: 5000]
|
|
239
238
|
--data-dir <path> Host data path or Docker volume name [default: opspilot-data]
|
package/package.json
CHANGED