@fyresmith/hive-server 2.3.1 → 2.3.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/cli/tunnel.js +17 -1
- package/package.json +1 -1
package/cli/tunnel.js
CHANGED
|
@@ -160,7 +160,18 @@ export async function ensureDnsRoute({ tunnelName, domain }) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export async function installCloudflaredService() {
|
|
163
|
-
|
|
163
|
+
try {
|
|
164
|
+
await runInherit('sudo', ['cloudflared', 'service', 'install']);
|
|
165
|
+
} catch (err) {
|
|
166
|
+
const output = getCloudflaredErrorOutput(err);
|
|
167
|
+
if (!isAlreadyInstalledCloudflaredService(output)) {
|
|
168
|
+
throw err;
|
|
169
|
+
}
|
|
170
|
+
warn('cloudflared service already installed; skipping reinstall');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Ensure the existing/new service is actually running.
|
|
174
|
+
await startCloudflaredServiceIfInstalled();
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
function isMissingCloudflaredService(output) {
|
|
@@ -175,6 +186,11 @@ function isMissingCloudflaredService(output) {
|
|
|
175
186
|
);
|
|
176
187
|
}
|
|
177
188
|
|
|
189
|
+
function isAlreadyInstalledCloudflaredService(output) {
|
|
190
|
+
const text = String(output ?? '').toLowerCase();
|
|
191
|
+
return text.includes('cloudflared service is already installed at');
|
|
192
|
+
}
|
|
193
|
+
|
|
178
194
|
function getCloudflaredErrorOutput(err) {
|
|
179
195
|
return [
|
|
180
196
|
err?.stdout,
|