dsh-plugin-mobile-gateway 0.6.3 → 0.6.4
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/README.md +2 -0
- package/bin/setup-ip.mjs +19 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/bin/setup-ip.mjs
CHANGED
|
@@ -23,6 +23,21 @@ const HELPER_INSTALL = '/usr/local/libexec/dsh-mobile-gateway-helper'
|
|
|
23
23
|
const HELPER_SERVICE = '/etc/systemd/system/dsh-mobile-gateway-helper.service'
|
|
24
24
|
const HELPER_SOCKET = '/run/dsh-mobile-gateway/helper.sock'
|
|
25
25
|
|
|
26
|
+
function currentPackageSpec() {
|
|
27
|
+
const manifest = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
|
|
28
|
+
if (typeof manifest.name !== 'string' || !manifest.name || typeof manifest.version !== 'string' || !manifest.version) {
|
|
29
|
+
throw new Error('package manifest is missing name or version')
|
|
30
|
+
}
|
|
31
|
+
return `${manifest.name}@${manifest.version}`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function pluginInstallArgs(packageSpec = currentPackageSpec()) {
|
|
35
|
+
return [
|
|
36
|
+
'plugin', '--profile', 'web', 'add', packageSpec,
|
|
37
|
+
`--config.minimum-release-age-exclude=${packageSpec}`,
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
function printHelp() {
|
|
27
42
|
console.log(`Usage:
|
|
28
43
|
dsh-plugin-mobile-gateway setup [--ip <public IPv4>] [--port 3080] [--email <address>] [--yes]
|
|
@@ -134,7 +149,8 @@ async function init() {
|
|
|
134
149
|
if (!commandExists('dsh') || !commandExists('sudo')) {
|
|
135
150
|
throw new Error('init requires dsh and sudo on PATH')
|
|
136
151
|
}
|
|
137
|
-
|
|
152
|
+
const packageSpec = currentPackageSpec()
|
|
153
|
+
run('dsh', pluginInstallArgs(packageSpec))
|
|
138
154
|
const script = fileURLToPath(import.meta.url)
|
|
139
155
|
run('sudo', ['env', `PATH=${process.env.PATH || ''}`, process.execPath, script, 'setup-helper'])
|
|
140
156
|
console.log('\nInitialization completed. Start or restart DSH with: dsh web')
|
|
@@ -419,9 +435,11 @@ async function remove(options) {
|
|
|
419
435
|
export {
|
|
420
436
|
assertPublicIpv4,
|
|
421
437
|
certName,
|
|
438
|
+
currentPackageSpec,
|
|
422
439
|
nginxHttpConfig,
|
|
423
440
|
nginxTlsConfig,
|
|
424
441
|
parseArgs,
|
|
442
|
+
pluginInstallArgs,
|
|
425
443
|
helperService,
|
|
426
444
|
renewalService,
|
|
427
445
|
renewalTimer,
|