@rip-lang/server 1.3.19 → 1.3.21
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/package.json +2 -2
- package/server.rip +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.21",
|
|
4
4
|
"description": "Pure Rip web framework and application server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "api.rip",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"rip-lang": ">=3.13.
|
|
48
|
+
"rip-lang": ">=3.13.37"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"api.rip",
|
package/server.rip
CHANGED
|
@@ -362,6 +362,9 @@ runSetup = ->
|
|
|
362
362
|
fn = mod?.setup or mod?.default
|
|
363
363
|
if typeof fn is 'function'
|
|
364
364
|
await fn()
|
|
365
|
+
# Send the DB URL to the Manager via IPC (null if rip-db was already running)
|
|
366
|
+
url = if typeof mod?.dbUrl is 'function' then mod.dbUrl() else null
|
|
367
|
+
process.send({ dbUrl: url }) if process.send
|
|
365
368
|
catch e
|
|
366
369
|
console.error "rip-server: setup failed:", e
|
|
367
370
|
process.exit(1)
|
|
@@ -500,6 +503,7 @@ class Manager
|
|
|
500
503
|
@retiringIds = new Set()
|
|
501
504
|
@currentVersion = 1
|
|
502
505
|
@server = null
|
|
506
|
+
@dbUrl = null
|
|
503
507
|
@appWatchers = new Map()
|
|
504
508
|
|
|
505
509
|
process.on 'SIGTERM', => @shutdown!
|
|
@@ -520,6 +524,8 @@ class Manager
|
|
|
520
524
|
stdin: 'ignore'
|
|
521
525
|
cwd: process.cwd()
|
|
522
526
|
env: setupEnv
|
|
527
|
+
ipc: (msg) => @dbUrl = msg.dbUrl if msg?.dbUrl
|
|
528
|
+
|
|
523
529
|
code = await proc.exited
|
|
524
530
|
if code isnt 0
|
|
525
531
|
console.error "rip-server: setup exited with code #{code}"
|
|
@@ -711,6 +717,8 @@ class Manager
|
|
|
711
717
|
return if @shuttingDown
|
|
712
718
|
@shuttingDown = true
|
|
713
719
|
@stop!
|
|
720
|
+
# Shutdown rip-db if we launched it — HTTP call, clean WAL checkpoint
|
|
721
|
+
try fetch!(@dbUrl + '/shutdown', { method: 'POST' }) if @dbUrl catch then null
|
|
714
722
|
process.exit(0)
|
|
715
723
|
|
|
716
724
|
getEntryMtime: ->
|