@justin0713/opspilot 1.0.3 → 1.0.5
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 +26 -12
- package/package.json +1 -1
package/bin/opspilot.js
CHANGED
|
@@ -20,6 +20,8 @@ const fs = require('fs');
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
const os = require('os');
|
|
22
22
|
|
|
23
|
+
const PKG_VERSION = require('../package.json').version;
|
|
24
|
+
|
|
23
25
|
// ── Constants ────────────────────────────────────────────────────────────────
|
|
24
26
|
|
|
25
27
|
const IMAGE = 'opspilot/local:latest';
|
|
@@ -99,11 +101,12 @@ function parseArgs(argv) {
|
|
|
99
101
|
function cmdStart(flags) {
|
|
100
102
|
checkDocker();
|
|
101
103
|
|
|
102
|
-
const cfg
|
|
103
|
-
const token
|
|
104
|
-
const url
|
|
105
|
-
const port
|
|
106
|
-
const data
|
|
104
|
+
const cfg = loadConfig();
|
|
105
|
+
const token = flags.token || cfg.token || '';
|
|
106
|
+
const url = flags['cloud-url'] || cfg.cloudUrl || '';
|
|
107
|
+
const port = flags.port || cfg.port || '5000';
|
|
108
|
+
const data = flags['data-dir'] || cfg.dataDir || 'opspilot-data';
|
|
109
|
+
const adminPass = flags['admin-password'] || '';
|
|
107
110
|
|
|
108
111
|
if (!token) {
|
|
109
112
|
die(
|
|
@@ -134,6 +137,9 @@ function cmdStart(flags) {
|
|
|
134
137
|
const isAbsolute = path.isAbsolute(data);
|
|
135
138
|
const volArg = `${data}:/app/data`;
|
|
136
139
|
|
|
140
|
+
// Admin password env (first-run only — ignored if users.json already exists in volume)
|
|
141
|
+
const adminEnv = adminPass ? `-e SHELLSHADOW_INITIAL_ADMIN_PASSWORD=${adminPass} ` : '';
|
|
142
|
+
|
|
137
143
|
log(`Starting OpsPilot Local on port ${port} ...`);
|
|
138
144
|
run(
|
|
139
145
|
`docker run -d ` +
|
|
@@ -142,6 +148,7 @@ function cmdStart(flags) {
|
|
|
142
148
|
`-e OPSPILOT_CLOUD_URL=${url || 'https://teams.codetop.net'} ` +
|
|
143
149
|
`-e OPSPILOT_CLOUD_TOKEN=${token} ` +
|
|
144
150
|
`-e OPSPILOT_PORT=5000 ` +
|
|
151
|
+
adminEnv +
|
|
145
152
|
`-v ${volArg} ` +
|
|
146
153
|
`--restart unless-stopped ` +
|
|
147
154
|
`${IMAGE}`
|
|
@@ -149,8 +156,14 @@ function cmdStart(flags) {
|
|
|
149
156
|
|
|
150
157
|
console.log('');
|
|
151
158
|
ok(`OpsPilot Local is running!`);
|
|
152
|
-
console.log(`${BOLD} URL
|
|
153
|
-
console.log(`${BOLD}
|
|
159
|
+
console.log(`${BOLD} URL :${RESET} http://localhost:${port}`);
|
|
160
|
+
console.log(`${BOLD} Username :${RESET} admin`);
|
|
161
|
+
if (adminPass) {
|
|
162
|
+
console.log(`${BOLD} Password :${RESET} ${adminPass} ${YELLOW}← change this after first login${RESET}`);
|
|
163
|
+
} else {
|
|
164
|
+
console.log(`${BOLD} Password :${RESET} ${YELLOW}check logs → opspilot logs | grep SECURITY${RESET}`);
|
|
165
|
+
}
|
|
166
|
+
console.log(`${BOLD} Data :${RESET} ${isAbsolute ? data : `docker volume '${data}'`}`);
|
|
154
167
|
console.log('');
|
|
155
168
|
console.log(` ${CYAN}opspilot logs -f${RESET} — tail live logs`);
|
|
156
169
|
console.log(` ${CYAN}opspilot stop${RESET} — stop the server`);
|
|
@@ -218,7 +231,7 @@ function cmdConfig() {
|
|
|
218
231
|
|
|
219
232
|
function printHelp() {
|
|
220
233
|
console.log(`
|
|
221
|
-
${BOLD}${CYAN}OpsPilot Local${RESET} — CLI
|
|
234
|
+
${BOLD}${CYAN}OpsPilot Local${RESET} — CLI v${PKG_VERSION}
|
|
222
235
|
|
|
223
236
|
${BOLD}Usage:${RESET}
|
|
224
237
|
opspilot <command> [options]
|
|
@@ -232,10 +245,11 @@ ${BOLD}Commands:${RESET}
|
|
|
232
245
|
${CYAN}config${RESET} Show saved local config
|
|
233
246
|
|
|
234
247
|
${BOLD}Start options:${RESET}
|
|
235
|
-
--token
|
|
236
|
-
--
|
|
237
|
-
--
|
|
238
|
-
--
|
|
248
|
+
--token <token> License token from OpsPilot Cloud ${YELLOW}(required)${RESET}
|
|
249
|
+
--admin-password <password> Set admin password on first run ${YELLOW}(recommended)${RESET}
|
|
250
|
+
--cloud-url <url> Cloud server URL [default: https://teams.codetop.net]
|
|
251
|
+
--port <port> Local port [default: 5000]
|
|
252
|
+
--data-dir <path> Host data path or Docker volume name [default: opspilot-data]
|
|
239
253
|
|
|
240
254
|
${BOLD}Examples:${RESET}
|
|
241
255
|
npx @justin0713/opspilot start --token eyJ...
|
package/package.json
CHANGED